Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Markdown file linter #6895

Merged
merged 10 commits into from
Jan 14, 2025
Merged

Conversation

mhucka
Copy link
Contributor

@mhucka mhucka commented Dec 29, 2024

This adds a config file .markdownlintrc for use with markdownlint.

This adds `check/markdownlint` and a corresponding configuration file
`.markdownlint.yaml`. Running `./check/markdownlint` will check all
`.md` files recursively from the top of the source tree, ignoring
subdirectories whose names start with a `.`. Arguments can be passed
to the script so that, e.g., `./check/markdownlint somefilename` will
lint just _somefilename_.
@CirqBot CirqBot added the size: S 10< lines changed <50 label Dec 29, 2024
Copy link

codecov bot commented Dec 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.86%. Comparing base (988ecbc) to head (a4dd7d7).
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6895   +/-   ##
=======================================
  Coverage   97.86%   97.86%           
=======================================
  Files        1084     1084           
  Lines       94408    94404    -4     
=======================================
  Hits        92393    92393           
+ Misses       2015     2011    -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Many existing Cirq Markdown files use bare URLs for things like email
addresses, because that's supported by GitHub-flavored Markdown.
@mhucka mhucka marked this pull request as ready for review December 30, 2024 05:16
@mhucka mhucka requested review from vtomole and a team as code owners December 30, 2024 05:16
@mhucka mhucka requested a review from tanujkhattar December 30, 2024 05:16
@mhucka mhucka added the kind/health For CI/testing/release process/refactoring/technical debt items label Dec 31, 2024
@mhucka mhucka self-assigned this Dec 31, 2024
Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename the config file to .markdownlintrc?

According to the docs that configuration file would be found by markdownlint from any subdirectory; we could then do without the check/markdownlint script.

Otherwise LGTM.

@mhucka
Copy link
Contributor Author

mhucka commented Jan 11, 2025

Can we rename the config file to .markdownlintrc?

According to the docs that configuration file would be found by markdownlint from any subdirectory; we could then do without the check/markdownlint script.

We can change the config file, but the reason there's a check/markdownlint script is to give it a default argument if the user invokes it simply as check/markdownlint (without any args). The behavior of the other scripts like check/pylint is to go from the current directory recursively down. The markdownlint program is unfortunate in always requiring an argument, so just running markdownlint will make it come back with a usage message. (To avoid that, the check/pylint script adds a . if there is no argument.)

If this difference in behavior (compared to other check/ scripts) is okay, then we don't need check/markdownlint.

@pavoljuhas
Copy link
Collaborator

If this difference in behavior (compared to other check/ scripts) is okay, then we don't need check/markdownlint.

I feel that is the better option - I'd prefer to move on to a standard invocation of code checking tools and remove check/sometool scripts as much as possible (#6800).

Would you mind adding a soft markdown CI check in a follow-up PR?

@mhucka
Copy link
Contributor Author

mhucka commented Jan 14, 2025

I feel that is the better option - I'd prefer to move on to a standard invocation of code checking tools and remove check/sometool scripts as much as possible

OK, no problem.

Would you mind adding a soft markdown CI check in a follow-up PR?

Yes – in fact, I had that in mind, and this is a step on that path!

mhucka and others added 4 commits January 13, 2025 21:47
Per discussion on PR quantumlib#6895, due to an apparent difference in behavior
of markdownlint, we decided to switch to using .markdownlintrc.
Per discussion on PR quantumlib#6895, we decided to work towards removing
unnecessary check/foo scripts in favor of having people run commands
directly.
@mhucka
Copy link
Contributor Author

mhucka commented Jan 14, 2025

Woops, @pavoljuhas I just realized that the linter with the behavior I described above is not markdownlint, but yamllint.

Still, deleting the check script for the other reasons discussed. I'll do the same for the yamllint PR.

mhucka added a commit to mhucka/Cirq that referenced this pull request Jan 14, 2025
Per discussion on PR quantumlib#6895, we decided to work towards removing
unnecessary check/foo scripts in favor of having people run commands
directly.
@mhucka mhucka enabled auto-merge (squash) January 14, 2025 16:40
@mhucka mhucka merged commit 326a287 into quantumlib:main Jan 14, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/health For CI/testing/release process/refactoring/technical debt items size: S 10< lines changed <50
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants