-
-
Notifications
You must be signed in to change notification settings - Fork 636
🧪 Integrate pymarkdown into pre-commit config #2256
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds PyMarkdown as a pre-commit hook to the repository for Markdown linting. This will help maintain consistent Markdown formatting and quality across documentation files.
- Added PyMarkdown pre-commit hook configuration
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
👍 for the idea of adding this hook -- I didn't know about this tool until today! -- but it looks like we have a number of fixes we need to apply for it to run cleanly. Some of these are easy and I'm happy to help apply (e.g., max line length) but some appear to be inappropriate lints for the specific files (e.g., MD041 on the changelog dir). How do we want to manage the configuration for this tool such that it's differentiated by file? I'm trying to read the |
Yep. I learned about it from a dep bump in ansible-core's test tooling and thought I'd try it locally. But since it produced a bunch of violations, I just made a commit and made the PR draft so that it's out in the open and isn't forgotten on my machine.
I haven't gotten that far but I'd maybe have two entries in the pre-commit config and include/exclude files on that level if there's no native way to solve this. |
|
There's some mentions of selective document set rules @ https://pymarkdown.rtfd.io/en/latest/advanced_configuration/#general-plugin-settings but I'd need to read more for specific examples. |
2aeabe0 to
2617afa
Compare
|
@sirosen I fixed a bunch of straightforward violations, need to start looking into suppressions. |
| its configuration to provision it with [tox devenv]. | ||
| - Always provide tests for your changes and run `tox -p all` to make sure they | ||
| are passing the checks locally. | ||
| - Give a clear one-line description in the PR (that the maintainers can add to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sirosen ^
CONTRIBUTING.md
Outdated
| version about to be released. | ||
| - Create a branch for the release. _Ex: release-3.4.0_. | ||
| - Update the [CHANGELOG] with the version, date and add the text from [drafter release](https://github.com/jazzband/pip-tools/releases). | ||
| - Update the [CHANGELOG] with the version, date and add the text from [drafter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sirosen ^
CONTRIBUTING.md
Outdated
| - The pip-tools "lead" project members will receive an email notification to review the release and | ||
| deploy it to the public PyPI if all is correct. | ||
| - Once ready, go to [releases](https://github.com/jazzband/pip-tools/releases) | ||
| page and publish the latest draft release. This will push a tag on the HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sirosen ^
2617afa to
ad5f0b3
Compare
|
So apparently, this linter has two docs folders and the one published to RTD doesn't have any mentions of the default config file name. But I've scanned the repo and found that it actually supports a |
| @@ -0,0 +1,5 @@ | |||
| --- | |||
|
|
|||
| {} | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to be replaced once upstream supports disabling rules per-file: jackdewinter/pymarkdown#1511.
|
I filed an upstream feature request to unblock us: jackdewinter/pymarkdown#1511. |
Turns out, there's a mention in some addition docs site: https://application-properties.rtfd.io/en/latest/file-types/#default-configuration-files (linked from https://pymarkdown.rtfd.io/en/latest/advanced_pre-commit/#specifying-a-configuration-file). |
|
Their dogfooding just runs the linter multiple times against different sets of files: https://github.com/jackdewinter/pymarkdown/blob/5d2572d026ff4db21d92d196fd4b69ab7b23fdb5/.pre-commit-config.yaml#L139-L162. Since the upstream is still unresponsive, I think I'll implement that as a workaround. |
|
@sirosen |
This is meant to ensure consistency in our Markdown content source. Ref: https://pymarkdown.rtfd.io
ad5f0b3 to
c0a3aa9
Compare
|
@sirosen I think this now has all the minimum changes needed to get it merged in. |
This is meant to ensure consistency in our Markdown content source.
Ref: https://pymarkdown.rtfd.io
Contributor checklist
changelog.d/(seechangelog.d/README.mdfor instructions) or the PR text says "no changelog needed".Maintainer checklist
skip-changeloglabel.