PRESUBMIT: Exclude some files from 80-character limit check.

Exclude the following files from 80-characters line limit check:
* DEPS
* GN files (.gn and .gni)
* GYP files (.gyp and .gypi)

BUG=webrtc:4794
TESTED=Ran the presubmit check with a modified DEPS and GYP file before this change and verified it failed. Re-ran after these changes and verified it passed. I also tested editing a .cc file to be >80 chars and verified the check found it.
R=andrew@webrtc.org, sergiyb@chromium.org

Review URL: https://codereview.webrtc.org/1323943012 .

Cr-Commit-Position: refs/heads/master@{#9877}
This commit is contained in:
Henrik Kjellander 2015-09-08 08:03:56 +02:00
parent 81db11aa50
commit 632246792f

View File

@ -292,8 +292,12 @@ def _CommonChecks(input_api, output_api):
# WebRTC can't use the presubmit_canned_checks.PanProjectChecks function since
# we need to have different license checks in talk/ and webrtc/ directories.
# Instead, hand-picked checks are included below.
# Skip long-lines check for DEPS, GN and GYP files.
long_lines_sources = lambda x: input_api.FilterSourceFile(x,
black_list=(r'.+\.gyp$', r'.+\.gypi$', r'.+\.gn$', r'.+\.gni$', 'DEPS'))
results.extend(input_api.canned_checks.CheckLongLines(
input_api, output_api, maxlen=80))
input_api, output_api, maxlen=80, source_file_filter=long_lines_sources))
results.extend(input_api.canned_checks.CheckChangeHasNoTabs(
input_api, output_api))
results.extend(input_api.canned_checks.CheckChangeHasNoStrayWhitespace(