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

Unified Diff: presubmit_canned_checks.py

Issue 2814017: Makefiles will always contain tabs so make the notab check filter them out. (Closed)
Patch Set: Use basename() instead Created 10 years, 6 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 | « no previous file | tests/presubmit_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_canned_checks.py
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py
index 5b972d63ec171810744457c147fe848f6942aab8..9588fb0eb9f9b0a4bc71cbfded9d3618e8ddff6d 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -213,8 +213,16 @@ def CheckChangeHasNoTabs(input_api, output_api, source_file_filter=None):
"""Checks that there are no tab characters in any of the text files to be
submitted.
"""
+ # In addition to the filter, make sure that makefiles are blacklisted.
+ if not source_file_filter:
+ # It's the default filter.
+ source_file_filter = input_api.FilterSourceFile
+ def filter_more(affected_file):
+ return (not input_api.os_path.basename(affected_file.LocalPath()) in
+ ('Makefile', 'makefile') and
+ source_file_filter(affected_file))
tabs = []
- for f, line_num, line in input_api.RightHandSideLines(source_file_filter):
+ for f, line_num, line in input_api.RightHandSideLines(filter_more):
if '\t' in line:
tabs.append('%s, line %s' % (f.LocalPath(), line_num))
if tabs:
« no previous file with comments | « no previous file | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698