diff --git a/PRESUBMIT.py b/PRESUBMIT.py index f9747fa1f6..2a3b61f7c3 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -78,9 +78,16 @@ def _CheckChangeHasEol(input_api, output_api, source_file_filter=None): def _PythonChecks(input_api, output_api): """Run checks on any modified Python files.""" - pylint_disabled_files = ( - 'infra/bots/recipes.py', - ) + blacklist = [ + r'infra[\\\/]bots[\\\/]recipes.py', + + # Blacklist DEPS. Those under third_party are already covered by + # input_api.DEFAULT_BLACK_LIST. + r'common[\\\/].*', + r'buildtools[\\\/].*', + ] + blacklist.extend(input_api.DEFAULT_BLACK_LIST) + pylint_disabled_warnings = ( 'F0401', # Unable to import. 'E0611', # No name in module. @@ -92,18 +99,10 @@ def _PythonChecks(input_api, output_api): 'W0613', # Unused argument. 'W0105', # String statement has no effect. ) - # Run Pylint on only the modified python files. Unfortunately it still runs - # Pylint on the whole file instead of just the modified lines. - affected_python_files = [] - for affected_file in input_api.AffectedSourceFiles(None): - affected_file_path = affected_file.LocalPath() - if affected_file_path.endswith('.py'): - if affected_file_path not in pylint_disabled_files: - affected_python_files.append(affected_file_path) return input_api.canned_checks.RunPylint( input_api, output_api, disabled_warnings=pylint_disabled_warnings, - white_list=affected_python_files) + black_list=blacklist) def _JsonChecks(input_api, output_api): diff --git a/tools/copyright/main.py b/tools/copyright/main.py index 24969a7ac5..e428448d21 100644 --- a/tools/copyright/main.py +++ b/tools/copyright/main.py @@ -67,7 +67,7 @@ def GetAllFilepaths(root_directory): @param root_directory root directory within which to find all files """ path_list = [] - for dirpath, dirnames, filenames in os.walk(root_directory): + for dirpath, _, filenames in os.walk(root_directory): for filename in filenames: path_list.append(os.path.abspath(os.path.join(dirpath, filename))) return path_list diff --git a/tools/jsondiff.py b/tools/jsondiff.py index 91e3e4b743..ed4731ad3a 100755 --- a/tools/jsondiff.py +++ b/tools/jsondiff.py @@ -130,7 +130,8 @@ class GMDiffer(object): if results_of_this_type: for test_name in results_of_this_type.keys(): digest_pair = results_of_this_type[test_name] - if digest_pair[0] != gm_json.JSONKEY_HASHTYPE_BITMAP_64BITMD5: + if (digest_pair[0] != + gm_json.JSONKEY_HASHTYPE_BITMAP_64BITMD5): raise ValueError( 'test %s has unsupported hashtype %s' % ( test_name, digest_pair[0])) @@ -138,7 +139,7 @@ class GMDiffer(object): return result_dict def _DictionaryDiff(self, old_dict, new_dict): - """Generate a dictionary showing the diffs between old_dict and new_dict. + """Generate a dictionary showing diffs between old_dict and new_dict. Any entries which are identical across them will be left out.""" diff_dict = {} all_keys = set(old_dict.keys() + new_dict.keys()) @@ -158,8 +159,9 @@ class GMDiffer(object): If newfile is not specified, then 'new' is the actual results within oldfile. """ - return self.GenerateDiffDictFromStrings(self._GetFileContentsAsString(oldfile), - self._GetFileContentsAsString(newfile)) + return self.GenerateDiffDictFromStrings( + self._GetFileContentsAsString(oldfile), + self._GetFileContentsAsString(newfile)) def GenerateDiffDictFromStrings(self, oldjson, newjson=None): """Generate a dictionary showing the diffs: