Skip to content

BUG: Inconsistent lint environments #36426

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

Closed
clbarnes opened this issue Sep 17, 2020 · 5 comments
Closed

BUG: Inconsistent lint environments #36426

clbarnes opened this issue Sep 17, 2020 · 5 comments
Labels
CI Continuous Integration Code Style Code style, linting, code_checks

Comments

@clbarnes
Copy link
Contributor

As of

, pre-commit uses flake8 3.8, where the other checks use 3.7.

As of

- isort>=5.2.1 # check that imports are in the right order
, conda environments use isort 5.2, where pre-commit uses 4.3.

This makes it impossible to create a commit which passes pre-commit and CI.

@clbarnes clbarnes added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 17, 2020
@TomAugspurger
Copy link
Contributor

I would recommend running the linting commands on CI through pre-commit. That way the versions in .pre-commit-config.yaml are used everywhere.

We could do this by updating our existing code-checks.sh, or by moving these checks to a GitHub action that uses the pre-commit action, like in dask/dask#6645.

@clbarnes
Copy link
Contributor Author

clbarnes commented Sep 17, 2020

A couple of possible issues with that approach is that CI will never catch differences between the environment.yml/ requirements-dev.txt version of linters and the pre-commit linters, but the former is what will be used by users' IDEs and development environments. Furthermore, pre-commit runs the "active" version of fixers like isort and black (i.e. it makes file changes), where CI should just be running the "passive" checks.

AFAIK there's no way to get pre-commit to respect tool versions specified in other files/ existing in the outer environment (and there shouldn't be given pre-commit's design goals). The MVP fix for this is just to change the version strings in the pre-commit config as it's only 3 lines.

Somewhat related: is there any documentation for the separation of concerns between the different CI jobs and backends?

@clbarnes
Copy link
Contributor Author

Looks like the mismatch in CI and pre-commit versions is intentional for flake8: #36412 (comment) . But it's breaking things for isort so I'll fix that.

@simonjayhawkins simonjayhawkins added CI Continuous Integration Code Style Code style, linting, code_checks and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 17, 2020
@jorisvandenbossche
Copy link
Member

Indeed, the bump for flake8 (and thus inconsistent with environment.yaml) was deliberate, because pre-commit was a bit unusable lately because of that.

@MarcoGorelli
Copy link
Member

this is fixed now, as pre-commit is used to run CI now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Code Style Code style, linting, code_checks
Projects
None yet
Development

No branches or pull requests

5 participants