Bug 1424148 - Local duplicate of global constant used in function. r=chutten
authorAditya Bharti <adibhar97@gmail.com>
Tue, 19 Dec 2017 13:56:39 +0530
changeset 448717 f9744e7abcf9a6f10ed058186c033710beffc280
parent 448716 adadbeff32ec32d837e09c1a303817b47576fc4b
child 448718 ec28a490365c49cfd4320648652441e1ad8e779f
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten
bugs1424148
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1424148 - Local duplicate of global constant used in function. r=chutten Used the global variable CPP_IDENTIFIER_PATTERN instead of the local variable 'pattern' in check_name function in parse_histograms.py.
toolkit/components/telemetry/parse_histograms.py
--- a/toolkit/components/telemetry/parse_histograms.py
+++ b/toolkit/components/telemetry/parse_histograms.py
@@ -286,20 +286,19 @@ associated with the histogram.  Returns 
         if name.startswith("LABELS_"):
             ParserError('Error for histogram name "%s":  can not start with "LABELS_".' %
                         (name)).handle_later()
 
         # To make it easier to generate C++ identifiers from this etc., we restrict
         # the histogram names to a strict pattern.
         # We skip this on the server to avoid failures with old Histogram.json revisions.
         if self._strict_type_checks:
-            pattern = '^[a-z][a-z0-9_]+[a-z0-9]$'
-            if not re.match(pattern, name, re.IGNORECASE):
+            if not re.match(CPP_IDENTIFIER_PATTERN, name, re.IGNORECASE):
                 ParserError('Error for histogram name "%s": name does not conform to "%s"' %
-                            (name, pattern)).handle_later()
+                            (name, CPP_IDENTIFIER_PATTERN)).handle_later()
 
     def check_expiration(self, name, definition):
         field = 'expires_in_version'
         expiration = definition.get(field)
 
         if not expiration:
             return