From db1887ddc3ccdac54ebfc2fb2db9dd9ddce40835 Mon Sep 17 00:00:00 2001 From: Boris Pavlovic Date: Thu, 9 Jul 2015 12:51:20 -0700 Subject: [PATCH] Improve hacking rule that checks that [] & {} are used It is bad to use list() or dict() instead of [] or {} because it has more symbols and works slower. Change-Id: I80e1a87c8f18c8dd231be421e065a2f329a3aa91 --- tests/hacking/checks.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/hacking/checks.py b/tests/hacking/checks.py index a413233b..232ae6f4 100644 --- a/tests/hacking/checks.py +++ b/tests/hacking/checks.py @@ -47,9 +47,9 @@ re_assert_equal_in_end_with_true_or_false = re.compile( re_assert_equal_in_start_with_true_or_false = re.compile( r"assertEqual\((True|False), (\w|[][.'\"])+( not)? in (\w|[][.'\", ])+\)") re_no_construct_dict = re.compile( - r"=\sdict\(\)") + r"\sdict\(\)") re_no_construct_list = re.compile( - r"=\slist\(\)") + r"\slist\(\)") re_str_format = re.compile(r""" % # start of specifier \(([^)]+)\) # mapping key, in group 1 @@ -57,7 +57,8 @@ re_str_format = re.compile(r""" (?:-?\d*)? # optional minimum field width (?:\.\d*)? # optional precision [hLl]? # optional length modifier -[A-z%] # conversion modifier""", re.X) +[A-z%] # conversion modifier +""", re.X) def skip_ignored_lines(func):