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

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

Issue 2792193003: web_dev_style: make CSS checker ignore /* <tags> in comments */ (Closed)
Patch Set: merge Created 3 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
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 5bdf88a57edbaa032e6acd430bbc2844cb2b23b8..7a7fe2c4246041de0ffdbd05ae1c7242c051cbf6 100644
--- a/chrome/browser/web_dev_style/css_checker.py
+++ b/chrome/browser/web_dev_style/css_checker.py
@@ -385,18 +385,21 @@ class CSSChecker(object):
file_filter=self.file_filter)
files = []
for f in affected_files:
- file_contents = '\n'.join(f.NewContents())
path = f.LocalPath()
+
+ is_html = path.endswith('.html')
+ if not is_html and not path.endswith('.css'):
+ continue
+
+ # Remove all /*comments*/, @at-keywords, and grit <if|include> tags; we're
+ # not using a real parser. TODO(dbeam): Check alpha in <if> blocks.
+ file_contents = _remove_all('\n'.join(f.NewContents()))
+
# Handle CSS files and HTML files with inline styles.
- if path.endswith('.html'):
+ if is_html:
file_contents = _extract_inline_style(file_contents)
- if path.endswith('.html') or path.endswith('.css'):
- # Remove all /*comments*/, @at-keywords, and grit <if|include> tags;
- # we're not using a real parser. TODO(dbeam): Check alpha in <if>
- # blocks.
- file_contents = _remove_all(file_contents)
- files.append((path, file_contents))
+ files.append((path, file_contents))
for f in files:
file_errors = []
« no previous file with comments | « chrome/browser/resources/settings/settings_shared_css.html ('k') | chrome/browser/web_dev_style/css_checker_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698