alexcouper / captainhook

Git hook scripts
BSD 3-Clause "New" or "Revised" License
54 stars 14 forks source link

flake8 not reporting errors #101

Open alexcouper opened 8 years ago

alexcouper commented 8 years ago

The redirection of stdout and stderr in the flake8 checker is not working as expected.

with change_folder(temp_folder):
        flake8_style = get_style_guide(config_file=DEFAULT_CONFIG)
        out, err = StringIO(), StringIO()
        with redirected(out, err):
            flake8_style.check_files(py_files)

Without the redirection, I see that flake8 is correctly detecting errors in files. With the redirection it appears that nothing is actually written to the StringIO objects.

Requires some investigation.

mknecht commented 8 years ago

why not use the exitcode to determine the error?

$ flake8 ; echo $?
./test.py:6:2: E225 missing whitespace around operator
./test.py:14:5: F841 local variable 'x' is assigned to but never used
./test.py:14:8: E225 missing whitespace around operator
1
$ flake8 ; echo $?
0