PRESUBMIT: Improve PyLint check and add GN format check.
Add pylintrc file based on https://code.google.com/p/chromium/codesearch#chromium/src/tools/perf/pylintrc bit tightened up quite a bit (the one in depot_tools is far more relaxed). Remove a few excluded directories from pylint check and fixed/ suppressed all warnings generated. Add GN format check + formatted all GN files using 'gn format'. Cleanup redundant rules in tools/PRESUBMIT.py TESTED=Ran 'git cl presubmit -vv', fixed the PyLint violations. Ran it again with a modification in webrtc/build/webrtc.gni, formatted all the GN files and ran it again. R=henrika@webrtc.org, phoglund@webrtc.org Review URL: https://webrtc-codereview.appspot.com/50069004 Cr-Commit-Position: refs/heads/master@{#9274}
This commit is contained in:
@ -8,13 +8,13 @@
|
||||
|
||||
def _LicenseHeader(input_api):
|
||||
"""Returns the license header regexp."""
|
||||
# Accept any year number from 2011 to the current year
|
||||
# Accept any year number from 2003 to the current year
|
||||
current_year = int(input_api.time.strftime('%Y'))
|
||||
allowed_years = (str(s) for s in reversed(xrange(2011, current_year + 1)))
|
||||
allowed_years = (str(s) for s in reversed(xrange(2003, current_year + 1)))
|
||||
years_re = '(' + '|'.join(allowed_years) + ')'
|
||||
license_header = (
|
||||
r'.*? Copyright \(c\) %(year)s The WebRTC project authors\. '
|
||||
r'All Rights Reserved\.\n'
|
||||
r'.*? Copyright( \(c\))? %(year)s The WebRTC [Pp]roject [Aa]uthors\. '
|
||||
r'All [Rr]ights [Rr]eserved\.\n'
|
||||
r'.*?\n'
|
||||
r'.*? Use of this source code is governed by a BSD-style license\n'
|
||||
r'.*? that can be found in the LICENSE file in the root of the source\n'
|
||||
@ -30,14 +30,6 @@ def _LicenseHeader(input_api):
|
||||
def _CommonChecks(input_api, output_api):
|
||||
"""Checks common to both upload and commit."""
|
||||
results = []
|
||||
results.extend(input_api.canned_checks.CheckLongLines(
|
||||
input_api, output_api, maxlen=80))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasNoTabs(
|
||||
input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasNoStrayWhitespace(
|
||||
input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeTodoHasOwner(
|
||||
input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckLicense(
|
||||
input_api, output_api, _LicenseHeader(input_api)))
|
||||
return results
|
||||
@ -50,13 +42,4 @@ def CheckChangeOnUpload(input_api, output_api):
|
||||
def CheckChangeOnCommit(input_api, output_api):
|
||||
results = []
|
||||
results.extend(_CommonChecks(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeWasUploaded(
|
||||
input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasDescription(
|
||||
input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasBugField(
|
||||
input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasTestField(
|
||||
input_api, output_api))
|
||||
return results
|
||||
|
Reference in New Issue
Block a user