diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-08-05 10:31:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-08-05 10:31:02 -0400 |
commit | 9a1e9b1d6c66e05049a6441e27f8388ad21c16a1 (patch) | |
tree | 405825e3d2f5e83f1b998c9569bcde447bda872a /scripts/maint/practracker/practracker.py | |
parent | 54ad92a240d8fe0997bf833272f041ee42de5ffb (diff) | |
download | tor-9a1e9b1d6c66e05049a6441e27f8388ad21c16a1.tar.gz tor-9a1e9b1d6c66e05049a6441e27f8388ad21c16a1.zip |
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.
Diffstat (limited to 'scripts/maint/practracker/practracker.py')
-rwxr-xr-x | scripts/maint/practracker/practracker.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/maint/practracker/practracker.py b/scripts/maint/practracker/practracker.py index 7e51edb48f..0fdfd4a40a 100755 --- a/scripts/maint/practracker/practracker.py +++ b/scripts/maint/practracker/practracker.py @@ -35,6 +35,10 @@ MAX_FILE_SIZE = 3000 # lines MAX_FUNCTION_SIZE = 100 # lines # Recommended number of #includes MAX_INCLUDE_COUNT = 50 +# Recommended file size for headers +MAX_H_FILE_SIZE = 500 +# Recommended include count for headers +MAX_H_INCLUDE_COUNT = 15 # Map from problem type to functions that adjust for tolerance TOLERANCE_FNS = { @@ -161,8 +165,12 @@ def main(argv): help="Make all warnings into errors") parser.add_argument("--terse", action="store_true", help="Do not emit helpful instructions.") + parser.add_argument("--max-h-file-size", default=MAX_H_FILE_SIZE, + help="Maximum lines per .H file") + parser.add_argument("--max-h-include-count", default=MAX_H_INCLUDE_COUNT, + help="Maximum includes per .H file") parser.add_argument("--max-file-size", default=MAX_FILE_SIZE, - help="Maximum lines per C file size") + help="Maximum lines per C file") parser.add_argument("--max-include-count", default=MAX_INCLUDE_COUNT, help="Maximum includes per C file") parser.add_argument("--max-function-size", default=MAX_FUNCTION_SIZE, @@ -180,9 +188,11 @@ def main(argv): # 0) Configure our thresholds of "what is a problem actually" filt = problem.ProblemFilter() - filt.addThreshold(problem.FileSizeItem("*", int(args.max_file_size))) - filt.addThreshold(problem.IncludeCountItem("*", int(args.max_include_count))) - filt.addThreshold(problem.FunctionSizeItem("*", int(args.max_function_size))) + filt.addThreshold(problem.FileSizeItem("*.c", int(args.max_file_size))) + filt.addThreshold(problem.IncludeCountItem("*.c", int(args.max_include_count))) + filt.addThreshold(problem.FileSizeItem("*.h", int(args.max_h_file_size))) + filt.addThreshold(problem.IncludeCountItem("*.h", int(args.max_h_include_count))) + filt.addThreshold(problem.FunctionSizeItem("*.c", int(args.max_function_size))) # 1) Get all the .c files we care about files_list = util.get_tor_c_files(TOR_TOPDIR) |