PyCQA / isort

A Python utility / library to sort imports.
https://pycqa.github.io/isort/
MIT License
6.45k stars 574 forks source link

Unrecognized arugment is the file name #1859

Closed wizard-28 closed 2 years ago

wizard-28 commented 2 years ago

I'm using pre-commit with Poetry so I'm using the local repo to use isort rather than the official hook.

Here's my config

  - repo: local
    hooks:
      - id: isort
        name: iSort
        description: Automatically sort import statements
        types_or: [cython, pyi, python]
        entry: poetry run isort
        args: ["--py auto", "-p cmds", "-p api", "-o rich", "-o requests", "--filter-files"]
        language: system
        require_serial: true

When the hook is run, this error message is printed

isort: error: unrecognized arguments: pacstall/cmds/download.py

Here pacstall/cmds/download.py is the concerned file.

How to fix this issue? Is this issue related to pre-commit instead?

wizard-28 commented 2 years ago

Fixed with adding = between the flags and their arguments.

        args: ["--py=auto", "-p=cmds", "-p=api", "-o=rich", "-o=requests", "--filter-files"]