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 396962 f9744e7abcf9
parent 396961 adadbeff32ec
child 396963 ec28a490365c
push id33117
push userebalazs@mozilla.com
push dateWed, 20 Dec 2017 09:47:43 +0000
treeherdermozilla-central@a235bf4868ab [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