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
Improve pre-commit config #9563
Conversation
| @@ -220,8 +221,9 @@ def get_precommit_requirements() -> dict[str, SpecifierSet]: | |||
| if not repo.get("python_requirement", True): | |||
| continue | |||
| hook = repo["hooks"][0] | |||
| package_name, package_rev = hook["id"], repo["rev"] | |||
| package_specifier = SpecifierSet(f"=={package_rev.removeprefix('v')}") | |||
| package_name = Path(urllib.parse.urlparse(repo["repo"]).path).name | |||
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.
Is this meant to be part of this PR?
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.
Yes. The test as it currently stands is poorly designed. Without this change, check_consistent.py fails if we add pre-commit-hooks to our pre-commit config, because of the fact that the hooks in the pre-commit-hooks repo have different names to the repo as a whole.
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.
Example failing run: https://github.com/python/typeshed/actions/runs/3949452817/jobs/6760681897
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 see, thanks!
trailing-whitespace: fixes trailing whitespacerequirements-txt-fixer: alphabetises items inrequirements.txtfilesend-of-file-fixer: makes sure every file ends with a single newline charactermixed-line-ending: Makes sure Windows users don't accidentally introduce CRLF line endings into a file that uses LF line endingscheck-yaml: loads YAML files to validate syntaxcheck-toml: loads TOML files to validate syntaxcheck-merge-conflict: detects merge-conflict strings in files and blocks them from accidentally being committedcheck-case-conflict: checks for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT; blocks them from being committed.blacklanguage target-version to Python 3.10, synching the setting here with the changes that were made to ourpyproject.tomlfile in Update black target version to py310 #7538