Show PresubmitResult call stacks in verbose mode
When a presubmit message, warning, or error strikes it is sometimes due
to a bug or weakness in the presubmit. Examining the presubmit or fixing
it can be important. However it can be hard to find the relevant code
(hint: many presubmits are in depot_tools/presubmit_canned_checks.py).
With this change you can just run the presubmits with -v -v (double
verbose) and a call stack will be recorded when each presubmit result
object is created. For instance:
>git cl presubmit --force --files ash/public/cpp/app_list/vector_icons/google_black.icon -v -v
** Presubmit Messages: 1 **
Trademarked images should not be added to the public repo. See crbug.com/944754
ash/public/cpp/app_list/vector_icons/google_black.icon
***************
Presubmit result call stack is:
File "depot_tools/presubmit_support.py", line 2098, in <module>
sys.exit(main())
File "depot_tools/presubmit_support.py", line 2074, in main
return DoPresubmitChecks(
File "depot_tools/presubmit_support.py", line 1771, in DoPresubmitChecks
results += executer.ExecPresubmitScript(presubmit_script, filename)
File "depot_tools/presubmit_support.py", line 1612, in ExecPresubmitScript
self._run_check_function(function_name, context, sink,
File "depot_tools/presubmit_support.py", line 1653, in _run_check_function
result = eval(function_name + '(*__args)', context)
File "<string>", line 1, in <module>
File "chromium/src/PRESUBMIT.py", line 2225, in CheckNoProductIconsAddedToPublicRepo
message_type(
File "depot_tools/presubmit_support.py", line 352, in __init__
self._long_text += ' '.join(traceback.format_stack(None, 8))
This changes tracking down presubmits from a dark art to a trivial operation.
Bug: 1309977
Change-Id: Ia0a6adfbbab04041f97c56cd2064a1627e252561
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3896076
Reviewed-by: Dmitrii Kuragin <kuragin@chromium.org>
Commit-Queue: Dmitrii Kuragin <kuragin@chromium.org>
changes/76/3896076/6
parent
ecfab09639
commit
dca14bc463
Loading…
Reference in New Issue