Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: PRESUBMIT.py

Issue 841323002: Revert of Add PRESUBMIT check if modified UMA histogram name can be found (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index d41cc7574a008a546551c86da513dd07463917bd..0b9db62290d9d8b454cc989d045b4f79ba9454d0 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -357,53 +357,6 @@ def _CheckNoUNIT_TESTInSourceFiles(input_api, output_api):
return [output_api.PresubmitPromptWarning('UNIT_TEST is only for headers.\n' +
'\n'.join(problems))]
-def _CheckUmaHistogramChanges(input_api, output_api):
- """Check that UMA histogram names in touched lines can still be found in other
- lines of the patch or in histograms.xml. Note that this check would not catch
- the reverse: changes in histograms.xml not matched in the code itself."""
-
- touched_histograms = []
- histograms_xml_modifications = []
- pattern = input_api.re.compile('UMA_HISTOGRAM.*\("(.*)"')
- for f in input_api.AffectedFiles():
- # If histograms.xml itself is modified, keep the modified lines for later.
- if (f.LocalPath().endswith(('histograms.xml'))):
- histograms_xml_modifications = f.ChangedContents()
- continue
- if (not f.LocalPath().endswith(('cc', 'mm', 'cpp'))):
- continue
- for line_num, line in f.ChangedContents():
- found = pattern.search(line)
- if found:
- touched_histograms.append([found.group(1), f, line_num])
-
- # Search for the touched histogram names in the local modifications to
- # histograms.xml, and if not found on the base file.
- problems = []
- for histogram_name, f, line_num in touched_histograms:
- histogram_name_found = False
- for line_num, line in histograms_xml_modifications:
- if histogram_name in line:
- histogram_name_found = True;
- break;
- if histogram_name_found:
- continue
-
- with open('tools/metrics/histograms/histograms.xml') as histograms_xml:
- for line in histograms_xml:
- if histogram_name in line:
- histogram_name_found = True;
- break;
- if histogram_name_found:
- continue
- problems.append(' [%s:%d] %s' % (f.LocalPath(), line_num, histogram_name))
-
- if not problems:
- return []
- return [output_api.PresubmitPromptWarning('Some UMA_HISTOGRAM lines have '
- 'been modified and the associated histogram name has no match in either '
- 'metrics/histograms.xml or the modifications of it:', problems)]
-
def _CheckNoNewWStrings(input_api, output_api):
"""Checks to make sure we don't introduce use of wstrings."""
@@ -1593,7 +1546,6 @@ def CheckChangeOnUpload(input_api, output_api):
results.extend(_CommonChecks(input_api, output_api))
results.extend(_CheckValidHostsInDEPS(input_api, output_api))
results.extend(_CheckJavaStyle(input_api, output_api))
- results.extend(_CheckUmaHistogramChanges(input_api, output_api))
results.extend(
input_api.canned_checks.CheckGNFormatted(input_api, output_api))
return results
« no previous file with comments | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698