alexcouper / captainhook

Git hook scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`flake8` checkers overrides tox.ini defaults

OddBloke opened this issue · comments

We (unsurprisingly) don't care about our migrations passing flake8.

Unfortunately, in passing a list of files to flake8, the checker overrides our tox.ini settings (as it's running e.g. flake8 ott/team/migrations/0014_auto__add_field_teammemberabsence_working_days_absent.py ott/team/models.py).

Might it be worth hooking directly in to the flake8 git hook?

Actually, that's probably overkill (as it moves all of the modified files in to a temporary directory). The below lines are probably the interesting ones from that:

from flake8.main import DEFAULT_CONFIG

flake8_style = get_style_guide(config_file=DEFAULT_CONFIG, paths=['.'],
                                   **options)
report = flake8_style.check_files(files_to_check)

I'm looking at this now.