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

isort and pre-commit - not only Python files are processed #1154

Closed
jugmac00 opened this issue Feb 18, 2020 · 4 comments
Closed

isort and pre-commit - not only Python files are processed #1154

jugmac00 opened this issue Feb 18, 2020 · 4 comments

Comments

@jugmac00
Copy link
Contributor

jugmac00 commented Feb 18, 2020

I was using pre-commit (as in pre-commit.com) as follows:

  - repo: https://github.com/timothycrosley/isort
    rev: 4.3.21 
    hooks:
      - id: isort
        args: [--filter-files]

This worked perfectly.

Once I updated to 4.3.21-2, not only Python files, but also json, rst, po, mako, html, pot and cfg files were touched and modified by isort.

In the https://github.com/timothycrosley/isort/blob/develop/CHANGELOG.md I could not find an entry for 4.3.21-2 at all.

My current workaround is following config:

  - repo: https://github.com/timothycrosley/isort
    rev: 4.3.21-2
    hooks:
    - id: isort
      args: [--filter-files]
      files: \.py$

I am pretty new to both pre-commit and isort - so maybe I miss something.

Maybe I miss the point, but why would I want to use isort on a json or a po (translation) file?

P.S.: @asottiles pre-commits version is 2.0.1.

@asottile
Copy link
Member

that is very strange indeed -- the types: [python] should be limiting to python files

can you run identify-cli on some of the files that were changed for me?

it's also possible you're using a really old pre-commit which doensn't understand types -- but it doesn't look like that?

@jugmac00
Copy link
Contributor Author

jugmac00 commented Feb 18, 2020

Update
I guess I tracked the problem down - .pre-commit-hook.yaml is different for 4.3.21.zip (ok) and 4.3.21-2.zip (borked).

4.3.21

-   id: isort
    name: isort
    entry: isort
    require_serial: true
    language: python
    types: [python]

4.3.21-2

-   id: isort
    name: isort
    entry: isort
    require_serial: true
    additional_dependencies: []
    language: python

https://github.com/timothycrosley/isort/archive/4.3.21.zip
https://github.com/timothycrosley/isort/archive/4.3.21-2.zip

@asottile
Copy link
Member

ah that's what it is, the configuration for 4.3.21-2 is busted: https://github.com/timothycrosley/isort/blob/4.3.21-2/.pre-commit-hooks.yaml#L6

@jugmac00
Copy link
Contributor Author

Well, at least my .po files are now sorted! :-)

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

3 participants