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

Side by Side Diff: chrome/browser/resources/web_dev_style/css_checker.py

Issue 9958101: [WebUI] Fix rest of CSS style nits in misc. dirs so I can turn on CSS checker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/tracing/tracing_controller.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Presubmit script for Chromium WebUI resources. 5 """Presubmit script for Chromium WebUI resources.
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into gcl/git cl, and see 8 for more details about the presubmit API built into gcl/git cl, and see
9 http://www.chromium.org/developers/web-development-style-guide for the rules 9 http://www.chromium.org/developers/web-development-style-guide for the rules
10 we're checking against here. 10 we're checking against here.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 def suggest_rgb_from_hex(line): 114 def suggest_rgb_from_hex(line):
115 suggestions = ['rgb(%d, %d, %d)' % _rgb_from_hex(h.group(1)) 115 suggestions = ['rgb(%d, %d, %d)' % _rgb_from_hex(h.group(1))
116 for h in re.finditer(hex_reg, line)] 116 for h in re.finditer(hex_reg, line)]
117 return ' (replace with %s)' % ', '.join(suggestions) 117 return ' (replace with %s)' % ', '.join(suggestions)
118 118
119 def suggest_short_hex(line): 119 def suggest_short_hex(line):
120 h = re.search(hex_reg, line).group(1) 120 h = re.search(hex_reg, line).group(1)
121 return ' (replace with #%s)' % (h[0] + h[2] + h[4]) 121 return ' (replace with #%s)' % (h[0] + h[2] + h[4])
122 122
123 hsl = r'hsl\([^\)]*(?:[, ]|(?<=\())(?:0?\.?)?0%' 123 hsl = r'hsl\([^\)]*(?:[, ]|(?<=\())(?:0?\.?)?0%'
124 zeros = (r'[^0-9]0(?:\.0?)?' 124 zeros = (r'(?:^|\D)'
125 r'(?:px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|m?s|k?hz)' 125 r'(?:\.0|0(?:\.0?|px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|m?s|k?hz))'
126 r'(?!\s*\{)') 126 r'(?:\D|$)(?!\s*\{)')
127 def zero_length_values(line): 127 def zero_length_values(line):
128 return (re.search(zeros, line) and not re.search(hsl, line)) 128 return (re.search(zeros, line) and not re.search(hsl, line))
129 129
130 added_or_modified_files_checks = [ 130 added_or_modified_files_checks = [
131 { 'desc': 'Alphabetize properties and list vendor specific (i.e. ' 131 { 'desc': 'Alphabetize properties and list vendor specific (i.e. '
132 '-webkit) above standard.', 132 '-webkit) above standard.',
133 'test': alphabetize_props, 133 'test': alphabetize_props,
134 'multiline': True, 134 'multiline': True,
135 }, 135 },
136 { 'desc': 'Start braces ({) end a selector, have a space before them ' 136 { 'desc': 'Start braces ({) end a selector, have a space before them '
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 '%s:\n%s' % (f[0], '\n\n'.join(file_errors)))) 216 '%s:\n%s' % (f[0], '\n\n'.join(file_errors))))
217 217
218 if results: 218 if results:
219 # Add your name if you're here often mucking around in the code. 219 # Add your name if you're here often mucking around in the code.
220 authors = ['dbeam@chromium.org'] 220 authors = ['dbeam@chromium.org']
221 results.append(self.output_api.PresubmitNotifyResult( 221 results.append(self.output_api.PresubmitNotifyResult(
222 'Was the CSS checker useful? Send feedback or hate mail to %s.' % 222 'Was the CSS checker useful? Send feedback or hate mail to %s.' %
223 ', '.join(authors))) 223 ', '.join(authors)))
224 224
225 return results 225 return results
OLDNEW
« 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