Bug: Flake8 v. 3.0.0b2 doesn't parse git config settings correctly
Please provide the following version information
- Version of Python which has Flake8 installed (e.g.,
python -V
) 3.5.1 - How you installed Flake8 (e.g.,
pip
,apt
,yum
, etc.) pip- If you used pip, the version of pip installed (e.g.,
pip --version
) 8.1.2
- If you used pip, the version of pip installed (e.g.,
- Version of setuptools installed (e.g.,
python -c 'import setuptools; print(setuptools.__version__)'
) 18.2 - Version of Flake8 installed (i.e., copy and paste all of the output from
flake8 --version
) 3.0.0b2 (mccabe: 0.5.0, pycodestyle: 2.0.0, naming: 0.4.1, pyflakes: 1.2.3) CPython 3.5.1 on Darwin - (Since it's related) Output of
git --version
: git version 2.8.0
Please describe the problem or feature
After installing the flake8 pre-commit hook (flake8 --install-hook=git
), I added the following to my global git config:
[flake8]
strict = true
I then tried to make a commit that I knew would fail flake8. While flake8 correctly returned the errors, the commit was still accepted. I verified that git picked it up (the output from git config --bool flake8.strict
is true
).
If this is a bug report, please explain with examples (and example code) what you expected to happen and what actually happened.
I expected that the git commit would be rejected. After looking at the flake8 code a bit, I think I know why it's not rejecting it. The following is copy-pasted from my terminal:
>>> from flake8.main import git
>>> git.config_for('strict')
False
>>> git.git_config_for('flake8.strict')
'true\n'
>>>
Because of the trailing newline, the value doesn't match what's in flake8.defaults.TRUTHY_VALUES