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
STYLE use yaml anchors in .pre-commit-config.yaml for flake8 #43282
Comments
@MarcoGorelli a question from a non yaml expert: how would you merge those two lists? I don't believe this will work because additional_dependencies: &version_check_dependencies [
flake8-comprehensions==3.1.0,
flake8-bugbear==21.3.2,
pandas-dev-flaker==0.2.0,
]
...
additional_dependencies:
- flake8==3.9.2
- *version_check_dependencies I cannot think of a way to get the second |
I have resolved the issue and generated a PR . |
Is this issue still open? |
yup! |
Can i take? @Kunsh-Manghwani has generated a PR |
Yes, you can take it, their PR hasn't been active for a while |
Here's another example: asottile/yesqa#49 (comment) |
I see this issue is pending since long |
Awesome, feel free to open a PR when you want |
@MarcoGorelli Sure |
Hey folks I had a quick look at this and found actually that this does not seem immediately fixable. From the
This entails the creation of an anchor and then merging two lists, however, this is not yet possible. for reference You can see The examples listed elsewhere in this issue can use an anchor since they reuse the same dependencies without the need of merging/extending lists |
I see, thanks for looking into this! I'll have another look next week, but this might need closing by the looks of it |
You can just use:
for both additional_dependencies. It's not like the flake8 additional requirement will conflict with the flake8 hook. (Just make sure to keep it updated). |
I suppose that is the easiest way around - if y'all are happy with that I can send a quick PR |
Seems good |
Instead of duplicating these lines
pandas/.pre-commit-config.yaml
Lines 42 to 45 in e39ea30
pandas/.pre-commit-config.yaml
Lines 79 to 83 in e39ea30
we would use a yaml anchor
See here for an example of how that works https://github.com/psf/black/pull/2459/files
This would also mean being able to get rid of a big part of https://github.com/pandas-dev/pandas/blob/e39ea3024cebb4e7a7fd35972a44637de6c41650/scripts/sync_flake8_versions.py
The text was updated successfully, but these errors were encountered: