Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Apakottur
Copy link

@Apakottur Apakottur commented 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
  2. pre-commit docs
  3. Same PR on pyupgrade
  4. Same PR on flake8

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)
@MarcoGorelli
Copy link
Owner

MarcoGorelli commented Dec 21, 2022

sorry, closed by accident

should be good, thanks @Apakottur , tried this out on pandas and it worked fine

@codecov
Copy link

codecov bot commented Dec 21, 2022

Codecov Report

Merging #77 (b6b832e) into main (7d9b57b) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##              main       #77   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          102       102           
=========================================
  Hits           102       102           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Apakottur
Copy link
Author

Note that the PRs on flake8/pyupgrade were not accepted, as the authors did not want to support pyi by default.
I guess both options make sense, and it depends on whether the linter is inherently supporting stub files or not.

@MarcoGorelli
Copy link
Owner

I think it should be fine here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants