autoep8似乎找不到配置文件?

2024-06-26 14:23:40 发布

您现在位置:Python中文网/ 问答频道 /正文

根据autoep8的文档(这里:https://github.com/hhatto/autopep8#configuration),如果我放置一个名为设置.cfg“在我的git repo的根中,有着

[pycodestyle]
ignore = D203,E501,E201,E202,E203,E211,E261,E265,W503
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist,__init__.py,*_gui.py
max-complexity = 25
max-line-length = 160
statistics = True

然后它应该会得到那个配置。在

我通过pre-commit钩子使用autoep8,这里:https://github.com/pre-commit/mirrors-autopep8

我只能说,它找不到设置.cfg. 我在同一个目录中还有一个用于flake8的.flake8文件-flake8的pre-commit钩子可以很容易地找到它。在

我发现,虽然autopep8只在修改过的文件上运行(很好),但它不排除*_图形用户界面.py在

这是虫子吗?我做错什么了吗?在


Tags: 文件文档pyhttpsgitgithubcomflake8
1条回答
网友
1楼 · 发布于 2024-06-26 14:23:40

我找到了一个解决方法:在预提交级别排除文件,而不是通过autoep8。在

在我们的预承诺中-配置.yaml文件:

-   repo: https://github.com/pre-commit/mirrors-autopep8
    rev: '4b4928307f1e6e8c9e02570ef705364f47ddb6dc'  # Use the sha / tag you want to point at
    hooks:
    -   id: autopep8
        exclude: (?i)^.*gui.py

现在它正确地排除了那些文件

相关问题 更多 >