-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
STYLE ignore no-else-* checks, + assorted cleanups #49750
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
Conversation
additional_dependencies: [pyyaml] | ||
additional_dependencies: [pyyaml, toml] |
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 unrelated to the pylint changes, but it's really minor so doing it while I'm here
The local hook just above has
- id: pip-to-conda
name: Generate pip dependency from conda
description: This hook checks if the conda environment.yml and requirements-dev.txt are equal
language: python
entry: python scripts/generate_pip_deps_from_conda.py
files: ^(environment.yml|requirements-dev.txt)$
pass_filenames: false
additional_dependencies: [pyyaml, toml]
, so this one might as well take toml
as a dep too and they'll share the same env
.pre-commit-config.yaml
Outdated
- repo: https://github.com/pycqa/pylint | ||
rev: v2.15.5 | ||
hooks: | ||
- id: pylint | ||
files: ^pandas/ | ||
exclude: | | ||
(?x) | ||
^pandas/tests # leave turned off | ||
|/_testing/ # leave turned off | ||
|^pandas/util/_test_decorators\.py # leave turned off | ||
|^pandas/_version\.py # leave turned off | ||
|^pandas/conftest\.py | ||
|^pandas/core/generic\.py | ||
|^pandas/core/internals/concat\.py | ||
|^pandas/core/reshape/merge\.py | ||
|^pandas/core/tools/datetimes\.py | ||
|^pandas/formats/format\.py | ||
|^pandas/io/formats/format\.py | ||
|^pandas/io/formats/style\.py | ||
|^pandas/io/json/_json\.py | ||
|^pandas/io/xml\.py | ||
|^pandas/util/_decorators\.py | ||
|^pandas/util/_doctools\.py | ||
args: [--disable=all, --enable=redefined-outer-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.
also while I'm touching pylint stuff - adding in a hook only runs the redefined-outer-name
hook, which is the pylint check I care the most about. As that's the only check it runs, this is pretty fast (17 seconds in total on my laptop)
the exclude
list will be gradually trimmed down as contributors tackle #49656
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.
17 seconds still seems very slow for when committing .. Although I assume that is for the full codebase?
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.
17 seconds when running --all-files
, per file it should be neglibile running on just pandas/core/generic.py
takes .01 seconds
nevermind, that's because it's in the exclude
section, so of course it's fast 🤦
If I remove generic.py
it from exclude
, it takes 2.69s on just that file, which is still kinda slow
can we add this stuff to the pre-commit hook so i can catch it locally instead of in the CI? |
could do, but @jorisvandenbossche had brought up that it's a pretty slow hook (esp. compared with the other ones) I'll see if there's a way to speed it up |
@jbrockmendel @jorisvandenbossche I don't there's much that can be done to speed up pylint - they say it's expected that it's slow because it's thorough. And to be fair, it has been helping find actual issues. To not disrupt local development, but to also help keep catch issues, I'd suggest:
|
this will help me out, thanks. The pain point for me is having stuff pass locally and then fail on the CI for some nitpicky reason. |
cool, so if we remove the nitpicky checks, then local development should still be fast and CI should only fail for reasons which are potential sources of bugs (e.g. and if the are failures because of other reasons deemed to be nitpicky, we can add them back to any objections to moving along with this? |
nope |
Trying this I'm getting |
sorry, typo, I meant |
cool, thanks - if someone approves I'll merge then |
.pre-commit-config.yaml
Outdated
|^pandas/util/_test_decorators\.py # keep excluded | ||
|^pandas/_version\.py # keep excluded | ||
|^pandas/conftest\.py # keep excluded | ||
|^pandas/core/generic\.py |
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.
Just so i understand, the reset of these should be tacked in the future?
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.
yup, that's right! It just makes reviews a bit easier - as contributors fix a file, they remove it from this list, and then CI confirms that they, indeed, did fix the issue in that file
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.
Looks good. Just a merge conflict and understanding question
hooks: | ||
- id: pylint | ||
alias: redefined-outer-name | ||
name: Redefining name from outer scope |
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.
What's the idea of adding this one that only runs a specific check if we already have a pylint one for all checks above? (since both are labeled as "manual" stage)
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 one can't be applied to all files, it has lots of false positives in tests because of fixtures
but, like this, we can turn it on for the non-test files
unfortunately pylint doesn't have a per-file-excludes option like flake8 does
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.
Ah, OK, thanks for the explanation!
thanks for reviewing! |
* ignore no-else-*, comment some checks as intentionally turned off, share env for two hooks * add redefined-outer-name check, but turn off in remaining files * keep redefined-outer-name to manual stage * update exclude list * reword * fixup after merge * fixup again Co-authored-by: MarcoGorelli <>
@jbrockmendel 's mentioned he's not keen on the
no-else-*
pylint checks, and to be fair, they are kinda nitpicky. Hard to imagine that they could ever help uncover a bugLet's keep them turned off then. Have added a section of "intentionally turned off checks"