1

I'm trying to use pre-commit with autopep8 running the command pre-commit run --all-files. My tree and files are as follows:

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

In .pre-commit-config.yaml:

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

In .flake8:

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

However when I run pre-commit run --all-files, my .flake8 file wasn't getting picked up, so I tried adding --global-config to .flake8:

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

but that just results in an error:

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

What am I doing wrong?

My pre-commit version is 1.18.2.

anthony sottile
  • 61,815
  • 15
  • 148
  • 207
ZaxR
  • 4,896
  • 4
  • 23
  • 42
  • Relates to https://stackoverflow.com/q/55172676/7619676, which hasn’t really been answered yet – ZaxR Aug 20 '19 at 23:51
  • Answered on the github issue -- the answer is roughly a duplicate to the linked question above: https://github.com/pre-commit/mirrors-autopep8/issues/2 – anthony sottile Sep 02 '19 at 22:56

0 Answers0