Consider adding progress indicator when performing checks on many files
jhauberg opened this issue · 2 comments
For example, in below example, we're checking a pretty large codebase and it is taking a while. The bottom line could be a good fit to indicate how far we are, and how much is left.
I think it could be easily added, something like:
Checking '/Users/jhh/Desktop/NetHack/src/mhitu.c' [65/201]... Found 311 violations
I think we only want this indication if we're checking at least more than one file.
Indicating file progress is a bit more difficult. I think that requires refactoring of the check
function.
I would make a separate function to expand inputs into a full list of supported files to check. That way, we would know ahead of time just how many files are actually going to be checked. It would also improve the check
function in being simpler; removing all the recursive funk that can be hard to wrap your head around.
When using --limit
we can't know ahead of time how many files are actually going to be checked, because it might cause collection to end before going through every file (e.g. if --limit=5
and the first file, out of a hundred files, has 5 violations, then it would end prematurely).
Maybe totally fine?
It would look something like:
$ python3 run.py --verbose ~/Desktop/NetHack/src/ --limit=10
Checking '/Users/jhh/Desktop/NetHack/src/wield.c' [1/107]... Found 10 violations
Don't use tabs to keep line lengths consistent (2 tabs) [no-tabs] in
/Users/jhh/Desktop/NetHack/src/wield.c:
1 /* NetHack 3.6⇥wield.c⇥$NHDT-Date: 1496959480 2017/06/08 22:04:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.54 $ */
Replace each tab with spaces (typically 4).
Always use braces for control statements [brace-statement-bodies] in
/Users/jhh/Desktop/NetHack/src/wield.c:
89 if (obj == uwep) {
90 ...
91 }
Add opening and ending braces for the statement body.
(...8 more suppressed)
Checked 27 rules in 0.1 seconds
Found 10 violations (1 severe) in 1/107 files