econchick/interrogate

No output during failure when -o, --output specified

GlenNicholls opened this issue · 1 comments

Environment

  • interrogate version(s): 1.5.0
  • Python version(s): 3.6-3.9

Description of the bug

When using the -o, --output flag, interrogate doesn't provide any output when the minimum docstring coverage is not met.

$interrogate -vv -o log.log dir/
$

What you expected to happen

I expect that at the very least interrogate would report why coverage failed. I think an improvement would be to change the -o, --output to not suppress stdout as I viewed that flag as a way to save a log of the results in CI. There is already a quiet flag which is why I was surprised when I saw coverage fail but no information as to why.

I think a better reporting structure would be something similar to darglint, flake8, black, etc. I find those useful because I can navigate directly to the file and line number from the terminal. When something fails, it always gives me exactly what I need in the terminal but verbosity allows for digging into deeper details when needed. When -o is specified, I think it should always write tables to the file with the highest verbosity. Then -v would increase the verbosity in stdout:

$ interrogate
FAILED (minimum: 100.0%, actual: 95.5%)
dir/file.py:125 some_fn MISSED
...

$ interrogate -v
FAILED (minimum: 100.0%, actual: 95.5%)
dir/file.py:125 some_fn MISSED
dir/file.py:130 some_cls COVERED
...

$ interrogate -vv
FAILED (minimum: 100.0%, actual: 95.5%)
<any internal logs>
dir/file.py:125 some_fn MISSED
dir/file.py:130 some_cls COVERED
dir/file.py:133 skip_me SKIPPED
dir/__init__.py SKIPPED
...

Then the passed case would be similar although I wouldn't expect it to spit anything out when interrogate passes unless I provide -v/-vv

Hi @GlenNicholls - so sorry for the belated reply!

I'm going to close this as wontfix - the intended behavior of -o/--output is to redirect output from stdout to a file. You didn't specify which operating system you're using (I suspect unix-like based on your example paths), but if you want both the regular stdout and write to a file, you can use the tee command on macOS or Linux (windows):

$ interrogate -vv | tee out.log

Thanks for using interrogate and the feedback!