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

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

Issue 9923005: [WebUI] Fix rest of CSS style nits so I can turn on CSS checker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removing PRESUBMIT.py change until ready Created 8 years, 9 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/tracing/tracing_controller.css ('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 1172cbaaa0818ed43af1996cfd2747d2044b774c..ffcea291886a52e71801668b37b63f7125998ed0 100644
--- a/chrome/browser/resources/web_dev_style/css_checker.py
+++ b/chrome/browser/resources/web_dev_style/css_checker.py
@@ -68,8 +68,11 @@ class CSSChecker(object):
return (m and (m.group(1).lower() != m.group(1) or
m.group(1).find('_') >= 0))
+ # Ignore single frames in a @keyframe, i.e. 0% { margin: 50px; }
+ frame_reg = r'\s*\d+%\s*{\s*[_a-zA-Z0-9-]+:(\s*[_a-zA-Z0-9-]+)+\s*;\s*}\s*'
def close_brace_on_new_line(line):
- return (line.find('}') >= 0 and re.search(r'[^ }]', line))
+ return (line.find('}') >= 0 and re.search(r'[^ }]', line) and
+ not re.match(frame_reg, line))
def colons_have_space_after(line):
return re.search(r':(?!//)\S[^;]+;\s*', line)
@@ -82,7 +85,7 @@ class CSSChecker(object):
r'(?!.*(?:{.*|,\s*)$)')
def hex_could_be_shorter(line):
m = re.search(hex_reg, line)
- return (m and _collapseable_hex(m.group(1)))
+ return (m and _is_gray(m.group(1)) and _collapseable_hex(m.group(1)))
small_seconds = r'(?:^|[^_a-zA-Z0-9-])(0?\.[0-9]+)s(?!-?[_a-zA-Z0-9-])'
def milliseconds_for_small_times(line):
@@ -97,7 +100,7 @@ class CSSChecker(object):
def one_selector_per_line(contents):
errors = []
for b in re.finditer(multi_sels, re.sub(any_reg, '', contents)):
- errors.append(' ' + b.group(1).strip())
+ errors.append(' ' + b.group(1).strip().splitlines()[-1:][0])
return errors
def rgb_if_not_gray(line):
@@ -209,7 +212,7 @@ class CSSChecker(object):
file_errors.append('- %s\n%s' %
(check['desc'], '\n'.join(check_errors)))
if file_errors:
- results.append(self.output_api.PresubmitError(
+ results.append(self.output_api.PresubmitPromptWarning(
'%s:\n%s' % (f[0], '\n\n'.join(file_errors))))
if results:
« no previous file with comments | « chrome/browser/resources/tracing/tracing_controller.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698