Fixed a ton of Python lint errors, enabled python lint checking.
BUG=
Review URL: https://webrtc-codereview.appspot.com/1166004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@3627 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 03933b8..dd78b12 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -6,8 +6,6 @@
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
-import os.path
-
def _LicenseHeader(input_api):
"""Returns the license header regexp."""
# Accept any year number from 2011 to the current year
@@ -67,10 +65,6 @@
'gtest\'s FRIEND_TEST() macro. Include testsupport/gtest_prod_util.h and '
'use FRIEND_TEST_ALL_PREFIXES() instead.\n' + '\n'.join(problems))]
-def _IsLintWhitelisted(file_name):
- """ Checks if a file is whitelisted for lint check."""
- return True
-
def _CheckApprovedFilesLintClean(input_api, output_api,
source_file_filter=None):
"""Checks that all new or whitelisted .cc and .h files pass cpplint.py.
@@ -100,7 +94,7 @@
files = []
for f in input_api.AffectedSourceFiles(source_file_filter):
# Note that moved/renamed files also count as added for svn.
- if (f.Action() == 'A' or _IsLintWhitelisted(f.LocalPath())):
+ if (f.Action() == 'A'):
files.append(f.AbsoluteLocalPath())
for file_name in files:
@@ -121,6 +115,27 @@
"""Checks common to both upload and commit."""
# TODO(kjellander): Use presubmit_canned_checks.PanProjectChecks too.
results = []
+ results.extend(input_api.canned_checks.RunPylint(input_api, output_api,
+ black_list=(r'^.*gviz_api\.py$',
+ r'^.*gaeunit\.py$',
+ r'^third_party/.*\.py$',
+ r'^testing/.*\.py$',
+ r'^tools/gyp/.*\.py$',
+ r'^tools/perf_expectations/.*\.py$',
+ r'^tools/python/.*\.py$',
+ r'^tools/python_charts/data/.*\.py$',
+ r'^tools/refactoring.*\.py$',
+ # TODO(phoglund): should arguably be checked.
+ r'^tools/valgrind-webrtc/.*\.py$',
+ r'^tools/valgrind/.*\.py$',
+ # TODO(phoglund): should arguably be checked.
+ r'^webrtc/build/.*\.py$',
+ r'^build/.*\.py$',
+ r'^out/.*\.py$',),
+ disabled_warnings=['F0401', # Failed to import x
+ 'E0611', # No package y in x
+ 'W0232', # Class has no __init__ method
+ ]))
results.extend(input_api.canned_checks.CheckLongLines(
input_api, output_api))
results.extend(input_api.canned_checks.CheckChangeHasNoTabs(