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

Side by Side Diff: presubmit_canned_checks.py

Issue 2277513002: Run auto-spell-checker (codespell) on files in depot_tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « git_common.py ('k') | upload_to_google_storage.py » ('j') | 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 """Generic presubmit checks that can be reused by other presubmit checks.""" 5 """Generic presubmit checks that can be reused by other presubmit checks."""
6 6
7 import os as _os 7 import os as _os
8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) 8 _HERE = _os.path.dirname(_os.path.abspath(__file__))
9 9
10 # Justifications for each filter: 10 # Justifications for each filter:
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 extra_maxlen = file_maxlen * 3 / 2 364 extra_maxlen = file_maxlen * 3 / 2
365 365
366 line_len = len(line) 366 line_len = len(line)
367 if line_len <= file_maxlen: 367 if line_len <= file_maxlen:
368 return True 368 return True
369 369
370 # Allow long URLs of any length. 370 # Allow long URLs of any length.
371 if any((url in line) for url in ('file://', 'http://', 'https://')): 371 if any((url in line) for url in ('file://', 'http://', 'https://')):
372 return True 372 return True
373 373
374 # If 'line-too-long' is explictly suppressed for the line, any length is 374 # If 'line-too-long' is explicitly suppressed for the line, any length is
375 # acceptable. 375 # acceptable.
376 if 'pylint: disable=line-too-long' in line and file_extension == 'py': 376 if 'pylint: disable=line-too-long' in line and file_extension == 'py':
377 return True 377 return True
378 378
379 if line_len > extra_maxlen: 379 if line_len > extra_maxlen:
380 return False 380 return False
381 381
382 if 'url(' in line and file_extension == 'css': 382 if 'url(' in line and file_extension == 'css':
383 return True 383 return True
384 384
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 for f in affected_files: 1176 for f in affected_files:
1177 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()] 1177 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()]
1178 rc = gn.main(cmd) 1178 rc = gn.main(cmd)
1179 if rc == 2: 1179 if rc == 2:
1180 warnings.append(output_api.PresubmitPromptWarning( 1180 warnings.append(output_api.PresubmitPromptWarning(
1181 '%s requires formatting. Please run:\n gn format %s' % ( 1181 '%s requires formatting. Please run:\n gn format %s' % (
1182 f.AbsoluteLocalPath(), f.LocalPath()))) 1182 f.AbsoluteLocalPath(), f.LocalPath())))
1183 # It's just a warning, so ignore other types of failures assuming they'll be 1183 # It's just a warning, so ignore other types of failures assuming they'll be
1184 # caught elsewhere. 1184 # caught elsewhere.
1185 return warnings 1185 return warnings
OLDNEW
« no previous file with comments | « git_common.py ('k') | upload_to_google_storage.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698