George Kadianakis
7157d80c6f
Merge branch 'tor-github/pr/1337'
2019-09-25 14:19:49 +03:00
teor
22c33ea7f7
practracker: Fix a typo in the usage message
...
Fixes bug 31828; bugfix on 0.4.2.1-alpha.
2019-09-24 14:37:43 +10:00
Nick Mathewson
25d55fa01e
Practracker: do not list problems when told to --list-overbroad.
2019-09-18 10:28:33 -04:00
Nick Mathewson
e7565855c0
Merge branch 'ticket31578' into ticket31578_merged
2019-09-11 08:59:29 -04:00
David Goulet
796a9b37ea
Merge branch 'tor-github/pr/1264'
2019-09-09 14:53:12 -04:00
Nick Mathewson
318de94e49
Fix a bug in practracker's handling of .may_include in headers
...
I was expecting our filter code to work in a way it didn't. I
thought that saying that DependencyViolation applied to "*" would
hit all of the files -- but actually, "*" wasn't implemented. I had
to say "*.c" and "*.h"
2019-09-05 16:16:20 -04:00
Nick Mathewson
651bbe8a0d
Practracker: only consider files under "src/"
2019-09-02 15:40:35 -04:00
Nick Mathewson
e3f7e5e65e
practracker: make filename terminology uniform
...
Previously we often referred to "C files" and "H files", which is
more ambiguous than ".c files" and ".h files".
2019-08-29 09:20:27 -04:00
Nick Mathewson
5b3741e05a
Document new practracker violation types, and add a practracker readme
...
Closes ticket 31476.
2019-08-21 10:17:26 -04:00
Nick Mathewson
cc48eff2d3
Merge branch 'ticket31176' into ticket31176_merged
2019-08-21 09:46:20 -04:00
Nick Mathewson
a5971d732e
Move include-violation checking into its own function.
2019-08-05 17:48:06 -04:00
Nick Mathewson
2a3c727dfe
Make includes interface more like the rest of practracker
...
Everything else assumes that somebody else will open the file for it.
2019-08-05 17:48:06 -04:00
Nick Mathewson
6b26281b50
practracker: a violation of a .may_include rule is now a problem.
...
We treat "0" as the expected number, and warn about everything
else. The problem type is "dependency-violation".
2019-08-05 17:48:06 -04:00
Nick Mathewson
9a1e9b1d6c
Teach practracker about .h files
...
I'm using 500 as a file size limit, and 15 as an include limit.
This affects comparatively few files, but I think they are the worst
ones.
Closes ticket 31175.
2019-08-05 10:31:02 -04:00
Nick Mathewson
a4e4896e66
practracker: restore exceptions.txt header when running --regen
2019-08-01 10:25:20 -04:00
Nick Mathewson
19536fd18d
practracker: replaces "overstrict" with "overbroad"
...
I had the logic reversed here.
2019-08-01 09:35:33 -04:00
Nick Mathewson
3221dc1b32
Lower check of TOR_DISABLE_PRACTRACKER
...
Since we sometimes call practracker directly, that's where we should
check the TOR_DISABLE_PRACTRACKER envvar.
2019-08-01 08:40:56 -04:00
Nick Mathewson
a79e2c2975
practracker: better warning/regen handling
...
Now that there is only one toplevel place where we print problems,
we can redirect just that one print to a file when we are
regenerating the exceptions.txt file. Previously we redirected
sys.stdout, which is naughty, and forced us to send warnings (and
warnings alone) to stderr.
2019-07-30 11:54:05 -04:00
Nick Mathewson
3f303c102a
Practracker: new flags to control output.
...
These flags let you suppress the message about the number of
problems and warnings, and let you control the thresholds above
which something counts as a problem.
I need this for testing.
2019-07-30 11:49:50 -04:00
Nick Mathewson
31a0b81854
practracker: Remove problemvault global.
2019-07-30 10:17:56 -04:00
Nick Mathewson
65cb4fead5
practracker: Move the warning/error distinction to a higher level.
...
Previously warnings were generated by magic inside ProblemVault; now
they're printed on demand.
2019-07-30 10:17:47 -04:00
Nick Mathewson
bcef6a5802
practracker: Refactor flow to use generators
...
Instead of having "consider" functions that have to call a global
ProblemVault, we can now generate all the metrics for the code
separately from the decision about what to do for them.
2019-07-30 09:24:41 -04:00
Nick Mathewson
ec13a727b0
practracker: Rename "Problem" to "Item".
...
I'm about to refactor the code into a set of iterators that yield
*all* the metrics for the code, and then add a filter on top of that
to return the problems.
2019-07-30 09:03:58 -04:00
Nick Mathewson
d6a3636cdc
Add a TOR_DISABLE_PRACTRACKER envvar for use by folks who don't care
...
Fixes part of bug 30752
2019-07-18 09:28:08 -04:00
Nick Mathewson
6303c9aa26
Practracker: add tolerances for exceptions
...
When an exception is present, we can now violate the limit by a little
bit and only produce a warning. The strict flag overrides this
behavior.
I've given file sizes a 2% tolerances and function sizes/include
counts a 10% tolerance.
Part of 30752
2019-07-18 09:28:08 -04:00
Nick Mathewson
a5e1fa3a03
Practracker: add a --list-overstrict option
...
This option lists every exception that is stricter than it needs to
be.
Part of 30752
2019-07-18 09:28:08 -04:00
Nick Mathewson
f93057fc0a
Pracktracker: give the number of new errors found.
...
Part of 29746.
2019-07-17 14:33:49 +02:00
teor
a10d4adc25
Stop assuming that /usr/bin/python3 exists
...
For scripts that work with python2, use /usr/bin/python.
Otherwise, use /usr/bin/env python3.
Fixes bug 29913; bugfix on 0.2.5.3-alpha.
2019-03-27 11:07:55 +10:00
Nick Mathewson
300e7d8c99
Merge branch 'practracker_regen'
2019-03-26 19:27:54 -04:00
Nick Mathewson
39e4494344
practracker: update usage note in docstring
2019-03-26 08:42:14 -04:00
Nick Mathewson
c2643842a9
practracker: add ability to regenerate exceptions file.
...
Also add a useful argument parser.
2019-03-25 16:09:11 -04:00
Nick Mathewson
0260e0f6fc
practracker: pass sys.argv to main() as an argument
2019-03-25 16:09:11 -04:00
Nick Mathewson
301e3f22ef
Practracker: add a string explaining the excptions file.
2019-03-25 16:09:11 -04:00
Taylor Yu
307c156fbe
Set file encoding in practracker.py
...
Explicitly set the file encoding to UTF-8 in practracker.py, to avoid
problems in some CI environments. Fixes bug 29789; bug not in any
released Tor.
2019-03-22 17:51:55 -05:00
George Kadianakis
a55c89c475
practracker: Be compatible with python2 which is used by travis/jenkins.
2019-03-14 02:15:32 +02:00
Nick Mathewson
e2512950b6
Improve failure message from check-best-practices
2019-03-13 09:27:29 -04:00
George Kadianakis
58de565988
Call practracker as part of check-local.
...
- Introduce 'make check-best-practices'.
- Fix up Tor topdir etc to work with the way 'make check-local' gets called.
- Make practracker less likely to print useless stuff.
2019-03-13 09:27:24 -04:00
George Kadianakis
31c1d91ffb
Exit with 1 if new issues were found. Also work with python3.
2019-02-27 19:31:41 +02:00
George Kadianakis
26c4f6cfd0
Add more intelligent problem tracking.
2019-02-27 18:34:13 +02:00
George Kadianakis
371ea65c08
Improve #include counting func and move it to metrics.py.
2019-02-27 17:05:00 +02:00
George Kadianakis
17dd316749
Initial commit of practracker.py .
2019-02-27 15:22:24 +02:00