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

Unified Diff: chrome/browser/resources/web_dev_style/css_checker.py

Issue 10115054: [WebUI] Fix 0-length unary term false positive in CSS presubmit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « chrome/browser/resources/test_presubmit.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/web_dev_style/css_checker.py
diff --git a/chrome/browser/resources/web_dev_style/css_checker.py b/chrome/browser/resources/web_dev_style/css_checker.py
index dc2355e4b9a5e139217bde4a6a7bbb81a0b18562..dbb4c5a480c1f9762df2e4ce851da272d815dd7a 100644
--- a/chrome/browser/resources/web_dev_style/css_checker.py
+++ b/chrome/browser/resources/web_dev_style/css_checker.py
@@ -124,11 +124,16 @@ class CSSChecker(object):
return ' (replace with #%s)' % (h[0] + h[2] + h[4])
hsl = r'hsl\([^\)]*(?:[, ]|(?<=\())(?:0?\.?)?0%'
- zeros = (r'(?:^|\D)'
+ zeros = (r'^.*(?:^|\D)'
Yoyo Zhou 2012/04/20 01:31:40 It seems like for the example "state0." in the tes
r'(?:\.0|0(?:\.0?|px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|m?s|k?hz))'
- r'(?:\D|$)(?!\s*\{)')
- def zero_length_values(line):
- return (re.search(zeros, line) and not re.search(hsl, line))
+ r'(?:\D|$)(?=[^{}]+?}).*$')
Yoyo Zhou 2012/04/20 01:31:40 The last } is literal, right? It's confusing witho
+ def zero_length_values(contents):
+ errors = []
+ for z in re.finditer(re.compile(zeros, re.MULTILINE), contents):
+ first_line = z.group(0).strip().splitlines()[0]
+ if not re.search(hsl, first_line):
+ errors.append(' ' + first_line)
+ return errors
added_or_modified_files_checks = [
{ 'desc': 'Alphabetize properties and list vendor specific (i.e. '
@@ -178,6 +183,7 @@ class CSSChecker(object):
{ 'desc': 'Make all zero length terms (i.e. 0px) 0 unless inside of '
'hsl() or part of @keyframe.',
'test': zero_length_values,
+ 'multiline': True,
},
]
« no previous file with comments | « chrome/browser/resources/test_presubmit.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698