Add and prefer the ruff-check pre-commit ID#124
Conversation
| name: ruff | ||
| description: "Run 'ruff' for extremely fast Python linting" | ||
| - id: ruff-check | ||
| name: ruff check |
There was a problem hiding this comment.
Change the display name to reflect the sub-command executed.
| description: "Run 'ruff' for extremely fast Python linting" | ||
| - id: ruff-check | ||
| name: ruff check | ||
| description: "Run 'ruff check' for extremely fast Python linting" |
| # Legacy alias | ||
| - id: ruff | ||
| name: ruff (legacy alias) |
There was a problem hiding this comment.
Retain the id: ruff hook ID as an alias. I've changed the name to display ruff (legacy alias), but this might be too aggressive for now -- would welcome thoughts.
ntBre
left a comment
There was a problem hiding this comment.
Thanks! This all looks reasonable to me, including the alias. I'd like to get @dhruvmanila's thoughts too, though, since I'm not that familiar with our pre-commit infrastructure.
Have you tested this locally? It looks like we don't really have any tests set up in CI here.
|
I believe you can use It seemed to work alright for me! A |
dhruvmanila
left a comment
There was a problem hiding this comment.
Thanks, this looks good. Sorry, it slipped from my notification somehow.
|
Thank you @dhruvmanila! A |
## Summary Update pre-commit hook id according to astral-sh/ruff-pre-commit#124
## Summary A couple of months ago now (astral-sh/ruff-pre-commit#124) we changed the hook ID from just `ruff` to `ruff-check` to mirror `ruff-format`. I noticed the `ruff (legacy alias)` when running pre-commit on the release today and realized we should probably update. ## Test Plan Commit on this PR: ```shell > git commit -m "Update pre-commit hook name" check for merge conflicts................................................Passed Validate pyproject.toml..............................(no files to check)Skipped mdformat.............................................(no files to check)Skipped markdownlint-fix.....................................(no files to check)Skipped blacken-docs.........................................(no files to check)Skipped typos....................................................................Passed cargo fmt............................................(no files to check)Skipped ruff format..........................................(no files to check)Skipped ruff check...........................................(no files to check)Skipped <-- prettier.................................................................Passed zizmor...............................................(no files to check)Skipped Validate GitHub Workflows............................(no files to check)Skipped shellcheck...........................................(no files to check)Skipped ``` Compared to the release branch: ```shell > pre-commit run ... cargo fmt............................................(no files to check)Skipped ruff format..........................................(no files to check)Skipped ruff (legacy alias)..................................(no files to check)Skipped ... ```
## Summary A couple of months ago now (astral-sh/ruff-pre-commit#124) we changed the hook ID from just `ruff` to `ruff-check` to mirror `ruff-format`. I noticed the `ruff (legacy alias)` when running pre-commit on the release today and realized we should probably update. ## Test Plan Commit on this PR: ```shell > git commit -m "Update pre-commit hook name" check for merge conflicts................................................Passed Validate pyproject.toml..............................(no files to check)Skipped mdformat.............................................(no files to check)Skipped markdownlint-fix.....................................(no files to check)Skipped blacken-docs.........................................(no files to check)Skipped typos....................................................................Passed cargo fmt............................................(no files to check)Skipped ruff format..........................................(no files to check)Skipped ruff check...........................................(no files to check)Skipped <-- prettier.................................................................Passed zizmor...............................................(no files to check)Skipped Validate GitHub Workflows............................(no files to check)Skipped shellcheck...........................................(no files to check)Skipped ``` Compared to the release branch: ```shell > pre-commit run ... cargo fmt............................................(no files to check)Skipped ruff format..........................................(no files to check)Skipped ruff (legacy alias)..................................(no files to check)Skipped ... ```
Align with the preferred ruff-pre-commit hook name: astral-sh/ruff-pre-commit#124
Align with the preferred ruff-pre-commit hook name: astral-sh/ruff-pre-commit#124
Align with the preferred ruff-pre-commit hook name: astral-sh/ruff-pre-commit#124
The ruff pre-commit hook has been updated to the ruff-check hook, as the former is now just an alias for the latter. The GitHub pull request, astral-sh/ruff-pre-commit#124, discusses these changes.
The ruff pre-commit hook has been updated to the ruff-check hook, as the former is now just an alias for the latter. The GitHub pull request, astral-sh/ruff-pre-commit#124, discusses these changes. The spacing underneath the 5th step in the README.md has changed due to Prettier's pre-commit hook formatting it.
The ruff pre-commit hook has been updated to the ruff-check hook, as the former is now just an alias for the latter. The GitHub pull request, astral-sh/ruff-pre-commit#124, discusses these changes. The spacing underneath the 5th step in the README.md has changed due to Prettier's pre-commit hook formatting it.
The ruff pre-commit hook has been updated to the ruff-check hook, as the former is now just an alias for the latter. The GitHub pull request, astral-sh/ruff-pre-commit#124, discusses these changes. The spacing underneath many lines within the code.md and infrastructure.md Markdown files has changed due to Prettier's pre-commit hook formatting them. Also, many link texts have changed to satisfy markdownlint's new MD059 rule (link text should be descriptive). The use_keywords_order_plays.yml playbook has changed to resolve ansible-lint name[unique] violations. Many role variables have been changed to resolve ansible-lint var-naming[no-role-prefix] violations. Passing the line number for tasks and plays (via 'data') as an argument to the create_matcherror method has changed due to how this attribute is to be accessed in relation to future versions of the ansible-core package (>= 2.19). This conclusion has come from reading ansible/ansible-lint#4554 and ansible/ansible-lint#4564. A version_changed attribute has been added to all rules to suppress a warning now generated from ansible-lint that complains when this attribute is missing. This behavior was introduced as of this commit: ansible/ansible-lint#4431. The value for this attribute models the one in the pyproject.toml file, in that it is not intended to hold much significance. This is primarily because I see little value in updating this attribute over time for internal rules. The _get_leaf_items method's type hint has changed from the union type 'list[Any] | dict[Any, Any]' to 'list[Any] | Mapping[Any, Any]' because the parent class type of ansiblelint.utils.Task has changed to be Mapping[str, Any]. The AnsibleUnicodeItems type alias now uses the 'type' keyword instead of TypeAlias, as this was recommended per ruff's non-pep695-type-alias rule.
The ruff pre-commit hook has been updated to the ruff-check hook, as the former is now just an alias for the latter. The GitHub pull request, astral-sh/ruff-pre-commit#124, discusses these changes. The spacing underneath many lines within the code.md and infrastructure.md Markdown files has changed due to Prettier's pre-commit hook formatting them. Also, many link texts have changed to satisfy markdownlint's new MD059 rule (link text should be descriptive). The use_keywords_order_plays.yml playbook has changed to resolve ansible-lint name[unique] violations. Many role variables have been changed to resolve ansible-lint var-naming[no-role-prefix] violations. Passing the line number for tasks and plays (via 'data') as an argument to the create_matcherror method has changed due to how this attribute is to be accessed in relation to future versions of the ansible-core package (>= 2.19). This conclusion has come from reading ansible/ansible-lint#4554 and ansible/ansible-lint#4564. A version_changed attribute has been added to all rules to suppress a warning now generated from ansible-lint that complains when this attribute is missing. This behavior was introduced as of this commit: ansible/ansible-lint#4431. The value for this attribute models the one in the pyproject.toml file, in that it is not intended to hold much significance. This is primarily because I see little value in updating this attribute over time for internal rules. The _get_leaf_items method's type hint has changed from the union type 'list[Any] | dict[Any, Any]' to 'list[Any] | Mapping[Any, Any]' because the parent class type of ansiblelint.utils.Task has changed to be Mapping[str, Any]. The AnsibleUnicodeItems type alias now uses the 'type' keyword instead of TypeAlias, as this was recommended per ruff's non-pep695-type-alias rule.
Refs: astral-sh/ruff-pre-commit#124 Signed-off-by: Mike Fiedler <miketheman@gmail.com>
The ruff pre-commit hook has been updated to the ruff-check hook, as the former is now just an alias for the latter. The GitHub pull request, astral-sh/ruff-pre-commit#124, discusses these changes. The spacing underneath the 5th step in the README.md has changed due to Prettier's pre-commit hook formatting it.
The reference to the pre-commit hook inside the tutorial was to the legacy alias `ruff` instead of the current `ruff-check`. Ref: astral-sh/ruff-pre-commit#124
## Summary The reference to the pre-commit hook inside the tutorial was to the legacy alias `ruff` instead of the current `ruff-check`. Ref: astral-sh/ruff-pre-commit#124 ## Test Plan Not applicable.
Switch the Ruff pre-commit hook from the deprecated `ruff` legacy alias to the canonical `ruff-check` hook ID, aligning the configuration with upstream changes in `ruff-pre-commit` and eliminating the “legacy alias” warning while preserving existing linting and auto-fix behavior. See astral-sh/ruff-pre-commit#124
Switch the Ruff pre-commit hook from the deprecated `ruff` legacy alias to the canonical `ruff-check` hook ID, aligning the configuration with upstream changes in `ruff-pre-commit` and eliminating the “legacy alias” warning while preserving existing linting and auto-fix behavior. See astral-sh/ruff-pre-commit#124
Switch the Ruff pre-commit hook from the deprecated `ruff` legacy alias to the canonical `ruff-check` hook ID, aligning the configuration with upstream changes in `ruff-pre-commit` and eliminating the “legacy alias” warning while preserving existing linting and auto-fix behavior. See astral-sh/ruff-pre-commit#124
Summary
Towards #123. Introduces the
ruff-checkpre-commit hook ID, updates documentation to prefer it, but retains theruffID for compatibility.cc @dhruvmanila @zanieb
A