- Notifications
You must be signed in to change notification settings - Fork262
chore: update pre-commit hooks#957
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
chore: update pre-commit hooks#957
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
1379a7e to1f7ed15Compare.pre-commit-config.yaml Outdated
| -id:ruff-format | ||
| name:ruff (format) | ||
| args:["."] | ||
| 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.
I think removing these two lines for both lint and fmt should switch it back to the more traditional behavior of only running on modified files, which IMO is the right behavior for a pre-commit hook (esp. since the checks run on everything in CI anyway)
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.
concur. only lets keep it the same version that is inpyproject.toml for now, and then also see if there is a dependabot configuration for this file. That is how we keep ruff updated inpyproject.toml. There is a PR forruff currently from dependabot but i haven't merged it yet because honestlyruff is releasing so frequently it's annoying. I'm slow rolling the updates here for this dependency. Just for awareness, I have it locked to the specific patch version because if there is a bug fix that re-enables a rule it would arbitrarily cause the CI to break upon their release. I'm not okay with that so I'll just slow roll the merges as its only a dev dependency.
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 don't think the hook version corresponds directly to the ruff version, though they may still be linked.
Not 100% sure on dependabot, but FWIW, Renovate does have experimental support (which works quite well) for keeping track of pre-commit hook versions.
I saw the comment, but I actually think (could be wrong) that having the old version of the pre-commit pinned here might be part of why people are seeing some fighting sometimes (as maybe the hook uses an internal version ofruff) tied to its own version?
I do see errors with the current ruff version if I runruff check locally as well, though (note: using Python 3.12 vs. 3.8, but the toml config does have target version set to 3.8) - do you not see that?
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.
per#958 (comment), adjusted to operate only on changed files. will double-check the behavior.
Uh oh!
There was an error while loading.Please reload this page.
0d1e180 to9a7a1ccCompareUh oh!
There was an error while loading.Please reload this page.
wyardley commentedJun 17, 2024
What I can do is pin back the |
ff72154 tofd225bdComparewyardley commentedJun 17, 2024
However, the hook version doesn't seem to affect the version of |
codejedi365 left a comment
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 bumped the project ruff version so that matches what is in the pre-commit definition. And then rebased this branch so that they are the same.
Also I did review theruff-pre-commit releases to find that each version corresponds to which ruff it uses under the hood.
codejedi365 commentedJun 17, 2024
I really believe this is because the pre-commit is not reading our config in the pyproject.toml file because if you see the lint job in the ci we have to specify the configuration file to ruff. Why it doesn't do this by default is besides me but it changes what is flagged in the CI |
wyardley commentedJun 17, 2024
Also, just read that the lint should come before format if lint is run with |
wyardley commentedJun 17, 2024
Also, I can try adding that argument here and see if that fixes the issue. |
wyardley commentedJun 17, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
So, just FWIW, I checked and adding Playing around with it locally, Ithink the actual issue is that having the $ ruff check --fix[...]tests/unit/semantic_release/hvcs/test_gitlab.py: 612:5 SIM117 Use a single`with` statement with multiple contexts instead of nested`with` statementstests/util.py: 15:34 N812 Lowercase`config` imported as non-lowercase`cliConfigModule`Found 26 errors.$ ruff check --diff$echo$?0 So even though there are findings, That said, we can leave this as it is here, and I can try ignoring and / or chipping away some of those other findings in another PR. Also, I think with this change, at least ruff should now only run against modified files. |
wyardley commentedJun 17, 2024
I'm trying to fix the mypy pre-commit issue with Just setting Another thing I can do separately, but Ithink with the versions of |
fd225bd toa9aa2f1Comparewyardley commentedJun 17, 2024
Threw up a draft first pass in#961 at the rest of the ruff failures and removing |
codejedi365 commentedJun 18, 2024
Let's just throw a
Probably but not sure. The less command line arguments the better. |
a9aa2f1 to79896e9Compare- Update pre-commit hooks- Switch away from deprecated flag to `ruff`- Resolve two minor pre-commit hook findings
79896e9 toabddf84Comparewyardley commentedJun 18, 2024
Ok, see how you think this looks now - removed what I think should be unnecessary args, also added that ignore. |
codejedi365 commentedJun 18, 2024
Thanks 🎉 |
Uh oh!
There was an error while loading.Please reload this page.
Note: the current
ruffpre-commit checks check., however, there are multiple existing errors. Maybe it would make sense to switchruffto run on changed files only unless--all-filesis passed? That would be gentler, especially if we're not requiring all these checks to pass (that said,#958 has some misc fixes that resolvesome of the outstanding flagged and non-ignored issues).ruffNote: I still see the following finding from
mypy:Maybe an inheritance issue with it being in
remote_hvcs_base.pyvs_base.py?There is also some commented out code that ruff is flagging - I can remove in another PR if you'd like.