Browse Source

Add number of presubmit errors/warnings in header

Headers currently have the format: `** Presubmit ${name} **`. Make these
more helpful by including the number of total errors there are.

Bug: 1341987
Change-Id: Ib41a133c31568d4264d73c14350f0bbd9590356a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3756169
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Gavin Mak 3 years ago
parent
commit
d22bf60721
2 changed files with 2 additions and 2 deletions
  1. 1 1
      presubmit_support.py
  2. 1 1
      tests/presubmit_unittest.py

+ 1 - 1
presubmit_support.py

@@ -1792,7 +1792,7 @@ def DoPresubmitChecks(change,
     for name in ['Messages', 'Warnings', 'ERRORS']:
       if name in messages:
         items = messages[name]
-        sys.stdout.write('** Presubmit %s **\n' % name)
+        sys.stdout.write('** Presubmit %s: %d **\n' % (name, len(items)))
         for item in items:
           item.handle()
           sys.stdout.write('\n')

+ 1 - 1
tests/presubmit_unittest.py

@@ -882,7 +882,7 @@ def CheckChangeOnCommit(input_api, output_api):
       text = (
           RUNNING_PY_CHECKS_TEXT + 'Warning, no PRESUBMIT.py found.\n'
           'Running default presubmit script.\n'
-          '** Presubmit ERRORS **\n!!\n\n'
+          '** Presubmit ERRORS: 1 **\n!!\n\n'
           'There were Python %d presubmit errors.\n'
           'Was the presubmit check useful? If not, run "git cl presubmit -v"\n'
           'to figure out which PRESUBMIT.py was run, then run git blame\n'