-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Enforce YAML formatting #13658
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?
Enforce YAML formatting #13658
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,74 +1,75 @@ | ||
| exclude: 'src/pip/_vendor/' | ||
|
|
||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v6.0.0 | ||
| hooks: | ||
| - id: check-builtin-literals | ||
| - id: check-added-large-files | ||
| - id: check-case-conflict | ||
| - id: check-toml | ||
| - id: check-yaml | ||
| - id: debug-statements | ||
| - id: end-of-file-fixer | ||
| exclude: WHEEL | ||
| - id: forbid-new-submodules | ||
| - id: trailing-whitespace | ||
| exclude: .patch | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v6.0.0 | ||
| hooks: | ||
| - id: check-builtin-literals | ||
| - id: check-added-large-files | ||
| - id: check-case-conflict | ||
| - id: check-toml | ||
| - id: debug-statements | ||
| - id: end-of-file-fixer | ||
| exclude: WHEEL | ||
| - id: forbid-new-submodules | ||
| - id: trailing-whitespace | ||
| exclude: .patch | ||
|
|
||
| - repo: https://github.com/psf/black-pre-commit-mirror | ||
| rev: 25.9.0 | ||
| hooks: | ||
| - id: black | ||
| - repo: https://github.com/google/yamlfmt | ||
| rev: v0.20.0 | ||
| hooks: | ||
| - id: yamlfmt | ||
| types: [yaml] | ||
|
|
||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.14.3 | ||
| hooks: | ||
| - id: ruff-check | ||
| args: [--fix] | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v6.0.0 | ||
| hooks: | ||
| - id: check-yaml | ||
|
|
||
| - repo: https://github.com/pre-commit/mirrors-mypy | ||
| rev: v1.18.2 | ||
| hooks: | ||
| - id: mypy | ||
| exclude: tests/data | ||
| args: ["--pretty", "--show-error-codes"] | ||
| additional_dependencies: [ | ||
| 'keyring==24.2.0', | ||
| 'nox==2024.03.02', | ||
| 'pytest', | ||
| 'types-docutils==0.20.0.3', | ||
| 'types-setuptools==68.2.0.0', | ||
| 'types-freezegun==1.1.10', | ||
| 'types-pyyaml==6.0.12.12', | ||
| 'typing-extensions', | ||
| ] | ||
| - repo: https://github.com/psf/black-pre-commit-mirror | ||
| rev: 25.9.0 | ||
| hooks: | ||
| - id: black | ||
|
Member
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. Has this changed the order of the blocks? If we need to keep a specific order, that seems a bit more annoying than just fixing formatting.
Member
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. The only order that changed is that the yaml linting takes place after the yaml formatting. This is a general best practice when both formatting and linting, if they both find issues then if the lint occurs before the format the format will change what the line numbers the lint was referring to, but if the format occurs before the lint then the lint line numbers remain valid. Unfortunately the git diff didn't do a good job on matching that things are mostly the same. |
||
|
|
||
| - repo: https://github.com/pre-commit/pygrep-hooks | ||
| rev: v1.10.0 | ||
| hooks: | ||
| - id: python-no-log-warn | ||
| - id: python-no-eval | ||
| - id: rst-backticks | ||
| files: .*\.rst$ | ||
| types: [file] | ||
| exclude: NEWS.rst # The errors flagged in NEWS.rst are old. | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.14.3 | ||
| hooks: | ||
| - id: ruff-check | ||
| args: [--fix] | ||
|
|
||
| - repo: https://github.com/codespell-project/codespell | ||
| rev: v2.4.1 | ||
| hooks: | ||
| - id: codespell | ||
| exclude: AUTHORS.txt|tests/data | ||
| args: ["--ignore-words", tools/codespell-ignore.txt] | ||
| - repo: https://github.com/pre-commit/mirrors-mypy | ||
| rev: v1.18.2 | ||
| hooks: | ||
| - id: mypy | ||
| exclude: tests/data | ||
| args: ["--pretty", "--show-error-codes"] | ||
| additional_dependencies: ['keyring==24.2.0', 'nox==2024.03.02', 'pytest', 'types-docutils==0.20.0.3', 'types-setuptools==68.2.0.0', 'types-freezegun==1.1.10', 'types-pyyaml==6.0.12.12', 'typing-extensions'] | ||
|
|
||
| - repo: local | ||
| hooks: | ||
| - id: news-fragment-filenames | ||
| name: NEWS fragment | ||
| language: fail | ||
| entry: NEWS fragment files must be named *.(process|removal|feature|bugfix|vendor|doc|trivial).rst | ||
| exclude: ^news/(.gitignore|.*\.(process|removal|feature|bugfix|vendor|doc|trivial).rst) | ||
| files: ^news/ | ||
| - repo: https://github.com/pre-commit/pygrep-hooks | ||
| rev: v1.10.0 | ||
| hooks: | ||
| - id: python-no-log-warn | ||
| - id: python-no-eval | ||
| - id: rst-backticks | ||
| files: .*\.rst$ | ||
| types: [file] | ||
| exclude: NEWS.rst # The errors flagged in NEWS.rst are old. | ||
|
|
||
| - repo: https://github.com/codespell-project/codespell | ||
| rev: v2.4.1 | ||
| hooks: | ||
| - id: codespell | ||
| exclude: AUTHORS.txt|tests/data | ||
| args: ["--ignore-words", tools/codespell-ignore.txt] | ||
|
|
||
| - repo: local | ||
| hooks: | ||
| - id: news-fragment-filenames | ||
| name: NEWS fragment | ||
| language: fail | ||
| entry: NEWS fragment files must be named *.(process|removal|feature|bugfix|vendor|doc|trivial).rst | ||
| exclude: ^news/(.gitignore|.*\.(process|removal|feature|bugfix|vendor|doc|trivial).rst) | ||
| files: ^news/ | ||
|
|
||
| ci: | ||
| autofix_prs: false | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| formatter: | ||
| retain_line_breaks_single: true | ||
| scan_folded_as_literal: true |
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 is weird. Why does one of these have a final comma but not the other?
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.
I agree, this is weird, I'll dig into why this is happening.