-
Notifications
You must be signed in to change notification settings - Fork 42
build(lint): consolidate linters under pre-commit #903
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Use consecutive numbering for ordered lists (1, 2, 3 instead of 1, 1, 1) | ||
| number = true | ||
|
|
||
| # Preserve original line wrapping | ||
| wrap = "keep" | ||
|
|
||
| [plugin.tables] | ||
| # Strip extra spaces from GFM tables (don't pad columns for alignment) | ||
| compact_tables = true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,63 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v4.5.0 | ||
| rev: v6.0.0 | ||
| hooks: | ||
| - id: end-of-file-fixer # Ensures single trailing newline | ||
| - id: trailing-whitespace # Removes trailing spaces | ||
| args: [--markdown-linebreak-ext=md] # Preserve markdown line breaks | ||
| - id: check-yaml # Validates YAML syntax | ||
| - id: check-merge-conflict # Prevents merge conflict markers | ||
| - id: check-toml # Validates TOML syntax | ||
| - id: end-of-file-fixer | ||
| - id: trailing-whitespace | ||
| args: [--markdown-linebreak-ext=md] | ||
| - id: check-yaml | ||
| - id: check-merge-conflict | ||
| - id: check-toml | ||
|
|
||
| - repo: local | ||
| - repo: https://github.com/mgedmin/check-python-versions | ||
| rev: "0.24.0" | ||
| hooks: | ||
| - id: hatch-lint | ||
| name: hatch lint check | ||
| entry: hatch run lint:check | ||
| language: system | ||
| types: [python] | ||
| pass_filenames: false | ||
| - id: check-python-versions | ||
| args: ["--only", "pyproject.toml,.github/workflows/test.yaml"] | ||
|
|
||
| - repo: https://github.com/editorconfig-checker/editorconfig-checker.python | ||
| rev: 3.2.1 | ||
| hooks: | ||
| - id: editorconfig-checker | ||
| alias: ec | ||
| # Exclude files that are auto-generated or strictly formatted elsewhere | ||
| exclude: | | ||
| (?x)^( | ||
| LICENSE| | ||
| .*\.lock| | ||
| dist/.* | ||
| )$ | ||
| - repo: https://github.com/hukkin/mdformat | ||
| rev: 1.0.0 | ||
| hooks: | ||
| - id: mdformat | ||
| additional_dependencies: | ||
| - mdformat-gfm # GitHub Flavored Markdown support (tables, autolinks, etc.) | ||
| - mdformat-simple-breaks # Use --- for thematic breaks instead of 70 underscores | ||
|
|
||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.11.11 | ||
| hooks: | ||
| # Linter runs before formatter so fixes (like removing imports) get formatted | ||
| - id: ruff-check | ||
| args: [--fix] | ||
| types_or: [python, pyi] | ||
| - id: ruff-format | ||
| types_or: [python, pyi] | ||
|
Comment on lines
+39
to
+47
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This block seens to fix Ruff formating and linting issues. How does pre-commit detect linting errors and fail when there is a problem?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there are any modifications made, it returns a non-zero error code (even if all the linting issues were fixed following these changes). |
||
|
|
||
| - repo: local | ||
| hooks: | ||
| - id: hatch-mypy | ||
| name: hatch mypy check | ||
| entry: hatch run mypy:check | ||
| language: system | ||
| types: [python] | ||
| pass_filenames: false | ||
|
|
||
| - id: mergify-lint | ||
| name: mergify lint | ||
| entry: hatch run lint:mergify | ||
| language: system | ||
| files: ^\.mergify\.yml$ | ||
| pass_filenames: false | ||
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 linter and formatter seems to replace all
*bullet points with-. It's a lot of noise that interferes with git history andgit annotate. The asterisk is a valid character for bullet points. I actually prefer it over dash, because it sticks out.Uh oh!
There was an error while loading. Please reload this page.
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.
It modified only 4 doc files, and out of those only 2 doc files (
docs/files.mddocs/using.md) had their lists updated to use-instead of*. I wouldn't call it "a lot of noise".I will also add that we use both
*and-for different lists across our docs inconsistently, so any commit that would line these up to a specific convention would require similar changes, since we didn't enforce consistency until now and we use both symbols. See the list items here for example, that weren't modified since they already use-.If you're concerned about git blame noise, I can move those lint changes to a separate commit (might require a separate PR since we squash merge?), and then add this commit to a
.git-blame-ignore-revsand then it'll be ignored on git blame.I tried to check if there's a config option / plugin to override that, but couldn't find one.
I don't really mind either option, but if I have to choose between a Markdown linter that requires Node.js to run, and adds complexity to run locally, and a linter that just uses
-for bullet points instead of*(completely valid Markdown), but runs locally and auto-fixes linting issues easily, I'll pick the other one that helps me work fast and more efficiently. I don't think this minor personal preference for docs that end up rendering the same way anyways, is worth blocking this PR.If it's really a big concern, we could write a small plugin to override it (plugins seem pretty simple - example) but I'd rather not because we might break stuff unintentionally and it'll require maintenance if the linter updates and changes the API.
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.
I'm consider about 100 changed lines a lot of noise.
That's a good idea. Let's move all auto-formatting changes to a separate commit.