Skip to content
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

Enable linting of stub files (.pyi) in pre-commit hook #771

Closed
wants to merge 1 commit into from

Conversation

Apakottur
Copy link

@Apakottur Apakottur commented Dec 21, 2022

Enable support for pyi files when using pyupgrade through pre-commit. This will run pyupgrade on stub files in addition to source files.

References:

  1. The same file on black
  2. pre-commit docs
  3. Same PR on flake8
  4. Same PR on absolufy-imports

Enable support for `pyi` files when using `pyupgrade` through `pre-commit`.
This will run pyupgrade on stub files in addition to source files.

References:
1. [The same file on black](https://github.com/psf/black/blob/main/.pre-commit-hooks.yaml)
2. [pre-commit docs](https://github.com/psf/black/blob/main/.pre-commit-hooks.yaml)
@Apakottur Apakottur changed the title Add support for pyi files in pre-commit Enable linting of stub files (.pyi) in pre-commit hook Dec 21, 2022
Apakottur added a commit to Apakottur/absolufy-imports that referenced this pull request Dec 21, 2022
Enable support for `pyi` files when using `absolufy-imports` through `pre-commit`. This will run absolufy-imports on stub files in addition to source files.

References:
1. [The same file on black](https://github.com/psf/black/blob/main/.pre-commit-hooks.yaml)
2. [pre-commit docs](https://github.com/psf/black/blob/main/.pre-commit-hooks.yaml)
3. [Same PR on pyupgrade](asottile/pyupgrade#771)
Apakottur added a commit to Apakottur/flake8 that referenced this pull request Dec 21, 2022
Enable support for `pyi` files when using `flake8` through `pre-commit`. This will run flake8 on stub files in addition to source files.
Note that by default flake8 doesn't run checks on `pyi` files, and most commonly the [flake8-pyi plugin](https://pypi.org/project/flake8-pyi/) is used to enable those files types and check them.
However, without the change in the pre-commit config file, the stub files are still ignored.

References:
1. [The same file on black](https://github.com/psf/black/blob/main/.pre-commit-hooks.yaml)
2. [pre-commit docs](https://github.com/psf/black/blob/main/.pre-commit-hooks.yaml)
3. [Same PR on pyupgrade](asottile/pyupgrade#771)
@asottile asottile closed this Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants