summaryrefslogtreecommitdiff
path: root/scripts/maint/practracker/practracker.py
AgeCommit message (Collapse)Author
2020-02-20Merge branch 'maint-0.4.3'Nick Mathewson
2020-02-19practracker: Read unicode files when using Python 2teor
Allow the "practracker" coding best practices checking script to read unicode files, when using Python 2. We made the script use unicode literals in 0.4.3.1-alpha, but didn't change the codec for opening files. Fixes bug 33374; bugfix on 0.4.3.1-alpha.
2020-02-16Stop assuming that /usr/bin/python existsPanagiotis Vasilopoulos
Fixes 33192
2020-02-03practracker: use shutil.move so --regen will work on windowsNick Mathewson
On windows you can't os.rename() a file if the target filename already exists.
2020-02-03practracker: add a --regen-overbroad option to remove overbroad exceptions.Nick Mathewson
Closes ticket 32372.
2020-01-14Merge branch 'maint-0.4.2'teor
2020-01-14practracker: print a notice to stderr when disabledteor
When TOR_DISABLE_PRACTRACKER is set, print a message to stderr when skipping practracker checks. Part of 32705.
2019-12-12python: Add __future__ imports for python 3 compatibilityteor
Except for src/ext, which we may not want to modify. Closes ticket 32732.
2019-10-16practracker: add a missing #.Nick Mathewson
2019-09-25Merge branch 'tor-github/pr/1337'George Kadianakis
2019-09-24practracker: Fix a typo in the usage messageteor
Fixes bug 31828; bugfix on 0.4.2.1-alpha.
2019-09-18Practracker: do not list problems when told to --list-overbroad.Nick Mathewson
2019-09-11Merge branch 'ticket31578' into ticket31578_mergedNick Mathewson
2019-09-09Merge branch 'tor-github/pr/1264'David Goulet
2019-09-05Fix a bug in practracker's handling of .may_include in headersNick Mathewson
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-02Practracker: only consider files under "src/"Nick Mathewson
2019-08-29practracker: make filename terminology uniformNick Mathewson
Previously we often referred to "C files" and "H files", which is more ambiguous than ".c files" and ".h files".
2019-08-21Document new practracker violation types, and add a practracker readmeNick Mathewson
Closes ticket 31476.
2019-08-21Merge branch 'ticket31176' into ticket31176_mergedNick Mathewson
2019-08-05Move include-violation checking into its own function.Nick Mathewson
2019-08-05Make includes interface more like the rest of practrackerNick Mathewson
Everything else assumes that somebody else will open the file for it.
2019-08-05practracker: a violation of a .may_include rule is now a problem.Nick Mathewson
We treat "0" as the expected number, and warn about everything else. The problem type is "dependency-violation".
2019-08-05Teach practracker about .h filesNick Mathewson
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-01practracker: restore exceptions.txt header when running --regenNick Mathewson
2019-08-01practracker: replaces "overstrict" with "overbroad"Nick Mathewson
I had the logic reversed here.
2019-08-01Lower check of TOR_DISABLE_PRACTRACKERNick Mathewson
Since we sometimes call practracker directly, that's where we should check the TOR_DISABLE_PRACTRACKER envvar.
2019-07-30practracker: better warning/regen handlingNick Mathewson
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-30Practracker: new flags to control output.Nick Mathewson
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-30practracker: Remove problemvault global.Nick Mathewson
2019-07-30practracker: Move the warning/error distinction to a higher level.Nick Mathewson
Previously warnings were generated by magic inside ProblemVault; now they're printed on demand.
2019-07-30practracker: Refactor flow to use generatorsNick Mathewson
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-30practracker: Rename "Problem" to "Item".Nick Mathewson
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-18Add a TOR_DISABLE_PRACTRACKER envvar for use by folks who don't careNick Mathewson
Fixes part of bug 30752
2019-07-18Practracker: add tolerances for exceptionsNick Mathewson
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-18Practracker: add a --list-overstrict optionNick Mathewson
This option lists every exception that is stricter than it needs to be. Part of 30752
2019-07-17Pracktracker: give the number of new errors found.Nick Mathewson
Part of 29746.
2019-03-27Stop assuming that /usr/bin/python3 existsteor
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-26Merge branch 'practracker_regen'Nick Mathewson
2019-03-26practracker: update usage note in docstringNick Mathewson
2019-03-25practracker: add ability to regenerate exceptions file.Nick Mathewson
Also add a useful argument parser.
2019-03-25practracker: pass sys.argv to main() as an argumentNick Mathewson
2019-03-25Practracker: add a string explaining the excptions file.Nick Mathewson
2019-03-22Set file encoding in practracker.pyTaylor Yu
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-14practracker: Be compatible with python2 which is used by travis/jenkins.George Kadianakis
2019-03-13Improve failure message from check-best-practicesNick Mathewson
2019-03-13Call practracker as part of check-local.George Kadianakis
- 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-02-27Exit with 1 if new issues were found. Also work with python3.George Kadianakis
2019-02-27Add more intelligent problem tracking.George Kadianakis
2019-02-27Improve #include counting func and move it to metrics.py.George Kadianakis
2019-02-27Initial commit of practracker.py .George Kadianakis