0

我正在尝试将 pre-commit 与运行命令的 autopep8 一起使用pre-commit run --all-files。我的树和文件如下:

.
├── project
│   ├── ...
├── docs
│   ├── ...
│   └── conf.py
├── .flake8
├── .pre-commit-config.yaml
├── setup.cfg
├── setup.py
└── tox.ini

.pre-commit-config.yaml

repos:
  - repo: https://github.com/pre-commit/mirrors-autopep8
    rev: v1.4.4
    hooks:
    -   id: autopep8

.flake8

[flake8]
exclude=.git,__pycache__,docs/conf.py,build,dist
...

但是,当我运行时pre-commit run --all-files,我的 .flake8 文件没有被拾取,所以我尝试将 --global-config 添加到 .flake8:

repos:
  - repo: https://github.com/pre-commit/mirrors-autopep8
    rev: v1.4.4
    hooks:
    -   id: autopep8
        args: [--global-config, .flake8]

但这只会导致错误:

autopep8: error: autopep8 only takes one filename as argument unless the "--in-place" or "--diff" args are used

我究竟做错了什么?

我的预提交版本是 1.18.2。

4

0 回答 0