Bug 1344832 - Enable flake8 rule E502: "the backslash is redundant between brackets". r+dexter r=Dexter

This patch enables flake8 rule E502:
"the backslash is redundant between brackets" in toolkit/components/telemetry
by removing the relative E502 entry from toolkit/components/telemetry/.flake8
and fixing the files for which the E502 error was reported.
Precisely 8 errors violating E502 rule were found and solved.

MozReview-Commit-ID: 1z8f3JjJ2gt

--HG--
extra : rebase_source : de0622506a4a5a074ea5afa739b8537832aa4096
This commit is contained in:
Federico Padua 2017-03-14 01:04:56 +01:00
Родитель 446e1333af
Коммит 62a009b097
5 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -1,5 +1,5 @@
[flake8]
# See http://pep8.readthedocs.io/en/latest/intro.html#configuration
ignore = E121, E123, E126, E129, E133, E226, E241, E242, E704, W503, E402, E502, E128, E501, E713, E222, E201, E202, W602, E127, W601
ignore = E121, E123, E126, E129, E133, E226, E241, E242, E704, W503, E402, E128, E501, E713, E222, E201, E202, W602, E127, W601
max-line-length = 99
filename = *.py, +.lint

Просмотреть файл

@ -20,7 +20,7 @@ def print_array_entry(output, histogram, name_index, exp_index, label_index, lab
cpp_guard = histogram.cpp_guard()
if cpp_guard:
print("#if defined(%s)" % cpp_guard, file=output)
print(" { %s, %s, %s, %s, %d, %d, %s, %d, %d, %s }," \
print(" { %s, %s, %s, %s, %d, %d, %s, %d, %d, %s },"
% (histogram.low(),
histogram.high(),
histogram.n_buckets(),

Просмотреть файл

@ -41,7 +41,7 @@ def write_scalar_info(scalar, output, name_index, expiration_index):
if cpp_guard:
print("#if defined(%s)" % cpp_guard, file=output)
print(" {{ {}, {}, {}, {}, {}, {} }},"\
print(" {{ {}, {}, {}, {}, {}, {} }},"
.format(scalar.nsITelemetry_kind,
name_index,
expiration_index,

Просмотреть файл

@ -134,10 +134,10 @@ def type_check_event_fields(identifier, name, definition):
def string_check(identifier, field, value, min_length=1, max_length=None, regex=None):
# Length check.
if len(value) < min_length:
raise ValueError("%s: value '%s' for field %s is less than minimum length of %d" %\
raise ValueError("%s: value '%s' for field %s is less than minimum length of %d" %
(identifier, value, field, min_length))
if max_length and len(value) > max_length:
raise ValueError("%s: value '%s' for field %s is greater than maximum length of %d" %\
raise ValueError("%s: value '%s' for field %s is greater than maximum length of %d" %
(identifier, value, field, max_length))
# Regex check.
if regex and not re.match(regex, value):

Просмотреть файл

@ -48,7 +48,7 @@ class ScalarType:
MAX_NAME_LENGTH = 40
for n in [group_name, probe_name]:
if len(n) > MAX_NAME_LENGTH:
raise ValueError("Name '{}' exceeds maximum name length of {} characters."\
raise ValueError("Name '{}' exceeds maximum name length of {} characters."
.format(n, MAX_NAME_LENGTH))
def check_name(name, error_msg_prefix, allowed_char_regexp):
@ -60,7 +60,7 @@ class ScalarType:
# Don't allow leading/trailing digits, '.' or '_'.
if re.search(r'(^[\d\._])|([\d\._])$', name):
raise ValueError(error_msg_prefix +
" name must not have a leading/trailing digit, a dot or underscore. Got: '{}'"\
" name must not have a leading/trailing digit, a dot or underscore. Got: '{}'"
.format(name))
check_name(group_name, 'Group', r'\.')
@ -114,7 +114,7 @@ class ScalarType:
raise KeyError(self._name + ' - unknown fields: ' + ', '.join(unknown_fields))
# Checks the type for all the fields.
wrong_type_names = ['{} must be {}'.format(f, ALL_FIELDS[f].__name__) \
wrong_type_names = ['{} must be {}'.format(f, ALL_FIELDS[f].__name__)
for f in definition.keys() if not isinstance(definition[f], ALL_FIELDS[f])]
if len(wrong_type_names) > 0:
raise TypeError(self._name + ' - ' + ', '.join(wrong_type_names))
@ -236,7 +236,7 @@ class ScalarType:
# behaviour for it.
release_channel_collection = \
self._definition.get('release_channel_collection', 'opt-in')
return 'nsITelemetry::' + ('DATASET_RELEASE_CHANNEL_OPTOUT' \
return 'nsITelemetry::' + ('DATASET_RELEASE_CHANNEL_OPTOUT'
if release_channel_collection == 'opt-out' else 'DATASET_RELEASE_CHANNEL_OPTIN')
@property