Commit 7157d80c authored by George Kadianakis's avatar George Kadianakis
Browse files

Merge branch 'tor-github/pr/1337'

parents 01a797be 82ad63ef
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -183,6 +183,7 @@ EXTRA_DIST+= \
	scripts/maint/practracker/testdata/ex0.txt 	\
	scripts/maint/practracker/testdata/ex1-expected.txt \
	scripts/maint/practracker/testdata/ex1.txt 	\
	scripts/maint/practracker/testdata/ex1-overbroad-expected.txt 	\
	scripts/maint/practracker/testdata/ex.txt 	\
	scripts/maint/practracker/testdata/header.h 	\
	scripts/maint/practracker/testdata/not_c_file	\

changes/ticket31338

0 → 100644
+4 −0
Original line number Diff line number Diff line
  o Minor bugfixes (best practices tracker):
    - When listing overbroad exceptions, do not also list problems,
      and do not list insufficiently broad exceptions. Fixes bug 31338;
      bugfix on 0.4.2.1-alpha.
+9 −0
Original line number Diff line number Diff line
@@ -224,6 +224,11 @@ def main(argv):
    filt.addThreshold(problem.DependencyViolationItem("*.c", int(args.max_dependency_violations)))
    filt.addThreshold(problem.DependencyViolationItem("*.h", int(args.max_dependency_violations)))

    if args.list_overbroad and args.regen:
        print("Cannot use --regen with --list-overbroad",
              file=sys.stderr)
        sys.exit(1)

    # 1) Get all the .c files we care about
    files_list = util.get_tor_c_files(TOR_TOPDIR, args.include_dir)

@@ -239,6 +244,10 @@ def main(argv):
        ProblemVault = problem.ProblemVault(exceptions_file)
        problem_file = sys.stdout

    if args.list_overbroad:
        # If we're listing overbroad exceptions, don't list problems.
        problem_file = util.NullFile()

    # 2.1) Adjust the exceptions so that we warn only about small problems,
    # and produce errors on big ones.
    if not (args.regen or args.list_overbroad or args.strict):
+4 −2
Original line number Diff line number Diff line
@@ -77,7 +77,9 @@ class ProblemVault(object):
        # (e.g. we went from 4k LoC to 3k LoC), but we do warn if the
        # situation worsened (e.g. we went from 60 includes to 80).
        status = problem.is_worse_than(self.exceptions[problem.key()])
        if status == STATUS_OK:

        # Remember that we used this exception, so that we can later
        # determine whether the exception was overbroad.
        self.used_exception_for[problem.key()] = problem

        return status
+6 −0
Original line number Diff line number Diff line
@@ -61,3 +61,9 @@ echo "ex1:"
run_practracker --exceptions "${DATA}/ex1.txt" > "${TMPDIR}/ex1-received.txt"

compare "${TMPDIR}/ex1-received.txt" "${DATA}/ex1-expected.txt"

echo "ex1.overbroad:"

run_practracker --exceptions "${DATA}/ex1.txt" --list-overbroad > "${TMPDIR}/ex1-overbroad-received.txt"

compare "${TMPDIR}/ex1-overbroad-received.txt" "${DATA}/ex1-overbroad-expected.txt"
Loading