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

Support for pyi files now types_or is implemented #247

Open
Greedquest opened this issue May 18, 2022 · 3 comments
Open

Support for pyi files now types_or is implemented #247

Greedquest opened this issue May 18, 2022 · 3 comments

Comments

@Greedquest
Copy link

Further to #103 which was closed at the time.

Would it be possible to update the pre-commit hooks for this repo to allow it to run by default on pyi files?

@Greedquest
Copy link
Author

Or alternatively is there a way to avoid this in my local config:

hooks:
-   id: reorder-python-imports
    files: \.pyi?$
    types: []

... as using types_or e.g.:

hooks:
-   id: reorder-python-imports
    types_or: [python, pyi]

... doesn't seem to do anything in the .pre-commit-config.yaml. Does this setting only work for the hooks config, not the client side one?

@MarcoGorelli
Copy link

MarcoGorelli commented May 21, 2022

@Greedquest in your own config you'll also have to override types, e.g. I think this should work:

hooks:
-   id: reorder-python-imports
    types_or: [python, pyi]
    types: [text]  # overwrite types: [python]

@Greedquest
Copy link
Author

Greedquest commented May 24, 2022

@MarcoGorelli Oh that's kind of crazy but makes sense I suppose, thanks! Is types: [text] the default value of types, equivalent to what happens when you don't specify it in the hooks config? (i.e. I understand we need to override it locally, presumably setting it back to the equivalent of what it would have been if it were never specified in the first place?)

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

No branches or pull requests

2 participants