DrInfy / DrInfy/sharpy-sc2

flake8 ignores exclude configuration when used through pre-commit hooks

Open
#52 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
79
Forks
35
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
When sharpy-sc2's pre-commit hooks are installed, flake8 will ignore excludes configured in .flake8 file.

This is by design, and pre-commits exclude should be used instead.

> Checked-in python files will be passed as positional arguments. flake8 will always lint explicitly passed arguments (flake8 --exclude has no effect). **Instead use pre-commit’s exclude**: ... regex to exclude files. pre-commit won’t ever pass untracked files to flake8 so excluding .git / .tox / etc. is unnecessary.

https://flake8.pycqa.org/en/latest/user/using-hooks.html

**Expected behavior**
Flake8 should work in similar way, whether launched with eg. `py -m flake8` or by the pre-commit hooks (installed by `pre-commit install`).

**Additional context**

sharpy-sc2 repo already contains multiple config files with the same excludes.

1. [.flake8](https://github.com/DrInfy/sharpy-sc2/blob/develop/.flake8)
1. [pyproject.toml](https://github.com/DrInfy/sharpy-sc2/blob/develop/pyproject.toml) for Black config
1. [pytest.ini](https://github.com/DrInfy/sharpy-sc2/blob/develop/pytest.ini)

Adding a fourth file with the same excluded directories would be... less than ideal.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.