소스 검색

Report more issues as errors with presubmit --all

Change crrev.com/c/3788227 fixed one instance of errors being treated as
warnings when running "git cl presubmit" with the --upload option. This
is undesirable when testing "git cl presubmit" with --all or --files,
because it makes the errors harder to find. This change fixes four
more newly discovered instances of this behavior.

That is, this change makes it so that pylint issues and other serious
problems will be reported as errors when running:

  git cl presubmit --force --all --upload

This will make the pylint errors that this command triggers easier to
find and fix:

  git cl presubmit --force --upload --files mojo\public\tools\bindings\*.py

This change does _not_ turn cpplint warnings into errors, even though
they are errors when running non-upload presubmits. That is because
there are several directories that only run cpplint on upload and these
directories have many errors and there is no short-term path to changing
this.

Bug: 1309977
Change-Id: If49f820fc6894dcd1d9aaaf4d932b04f79922bc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3791744
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Jesse McKenna <jessemckenna@google.com>
Bruce Dawson 3 년 전
부모
커밋
d895d01ac4
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      presubmit_canned_checks.py

+ 6 - 3
presubmit_canned_checks.py

@@ -152,7 +152,7 @@ def CheckAuthorizedAuthor(input_api, output_api, bot_allowlist=None):
   """For non-googler/chromites committers, verify the author's email address is
   in AUTHORS.
   """
-  if input_api.is_committing:
+  if input_api.is_committing or input_api.no_diffs:
     error_type = output_api.PresubmitError
   else:
     error_type = output_api.PresubmitPromptWarning
@@ -263,6 +263,9 @@ def CheckChangeLintsClean(input_api, output_api, source_file_filter=None,
     cpplint.ProcessFile(file_name, verbose_level)
 
   if cpplint._cpplint_state.error_count > 0:
+    # cpplint errors currently cannot be counted as errors during upload
+    # presubmits because some directories only run cpplint during upload and
+    # therefore are far from cpplint clean.
     if input_api.is_committing:
       res_type = output_api.PresubmitError
     else:
@@ -894,7 +897,7 @@ def GetPythonUnitTests(input_api, output_api, unit_tests, python3=False):
   DEPRECATED.
   """
   # We don't want to hinder users from uploading incomplete patches.
-  if input_api.is_committing:
+  if input_api.is_committing or input_api.no_diffs:
     message_type = output_api.PresubmitError
   else:
     message_type = output_api.PresubmitNotifyResult
@@ -1020,7 +1023,7 @@ def GetPylint(input_api,
       'Unsupported pylint version: %s' % version
   python2 = (version == '1.5')
 
-  if input_api.is_committing:
+  if input_api.is_committing or input_api.no_diffs:
     error_type = output_api.PresubmitError
   else:
     error_type = output_api.PresubmitPromptWarning