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

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

Issue 2345703004: web_dev_style: ignore --css-vars from alphabetical ordering requirement (Closed)
Patch Set: such tragic misspelling Created 4 years, 3 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
Index: chrome/browser/web_dev_style/css_checker.py
diff --git a/chrome/browser/web_dev_style/css_checker.py b/chrome/browser/web_dev_style/css_checker.py
index 3713561e5e129acc137b5a5bc8f790624a62d3b0..2ce8a6e282c15131e393abbd600ec70e56c39047 100644
--- a/chrome/browser/web_dev_style/css_checker.py
+++ b/chrome/browser/web_dev_style/css_checker.py
@@ -29,11 +29,12 @@ class CSSChecker(object):
return s[0] == s[1] == s[2] if len(s) == 3 else s[0:2] == s[2:4] == s[4:6]
def _remove_all(s):
- s = _remove_grit(s)
s = _remove_ats(s)
+ s = _remove_grit(s)
s = _remove_comments(s)
- s = _remove_template_expressions(s)
s = _remove_mixins(s)
+ s = _remove_template_expressions(s)
+ s = _remove_vars(s)
return s
def _remove_ats(s):
@@ -51,9 +52,6 @@ class CSSChecker(object):
def _remove_mixins(s):
return re.sub(re.compile(r'--[\d\w-]+: {.*?};', re.DOTALL), '', s)
- def _remove_template_expressions(s):
- return re.sub(re.compile(r'\${[^}]*}', re.DOTALL), '', s)
-
def _remove_grit(s):
grit_reg = re.compile(r"""
<if[^>]+>.*?<\s*/\s*if[^>]*>| # <if> contents </if>
@@ -62,6 +60,12 @@ class CSSChecker(object):
re.DOTALL | re.VERBOSE)
return re.sub(grit_reg, '', s)
+ def _remove_template_expressions(s):
+ return re.sub(re.compile(r'\${[^}]*}', re.DOTALL), '', s)
+
+ def _remove_vars(s):
+ return re.sub(re.compile(r'--[\d\w-]+: [^;]+?;', re.DOTALL), '', s);
dschuyler 2016/09/15 23:17:36 How about entries like this --foo: { option: cho
dschuyler 2016/09/15 23:17:36 I think the \d isn't needed (if I'm wrong on that
Dan Beam 2016/09/15 23:30:17 does that mean you want me to combine this with _r
dschuyler 2016/09/15 23:48:35 Ah, I see it now. Maybe just a comment saying that
Dan Beam 2016/09/17 02:06:19 Done.
dschuyler 2016/09/19 21:23:28 I'm pretty sure \d is redundant with \w within a [
Dan Beam 2016/09/22 02:13:25 Done.
+
def _rgb_from_hex(s):
if len(s) == 3:
r, g, b = s[0] + s[0], s[1] + s[1], s[2] + s[2]
« no previous file with comments | « no previous file | chrome/browser/web_dev_style/css_checker_test.py » ('j') | chrome/browser/web_dev_style/css_checker_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698