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

Unified Diff: presubmit_support.py

Issue 385007: Run pychecker over most scripts in depot_tools. Catched a few bugs. (Closed)
Patch Set: . Created 11 years, 1 month 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
Index: presubmit_support.py
diff --git a/presubmit_support.py b/presubmit_support.py
index d26c5370bf72d8d503156ac3c85db33250165871..fabf7e946cfff3ce4765e810205390f029da6b19 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -345,16 +345,16 @@ class InputApi(object):
files = self.AffectedSourceFiles(source_file_filter)
return InputApi._RightHandSideLinesImpl(files)
- def ReadFile(self, file, mode='r'):
+ def ReadFile(self, file_item, mode='r'):
"""Reads an arbitrary file.
Deny reading anything outside the repository.
"""
- if isinstance(file, AffectedFile):
- file = file.AbsoluteLocalPath()
- if not file.startswith(self.change.RepositoryRoot()):
+ if isinstance(file_item, AffectedFile):
+ file_item = file_item.AbsoluteLocalPath()
+ if not file_item.startswith(self.change.RepositoryRoot()):
raise IOError('Access outside the repository root is denied.')
- return gcl.ReadFile(file, mode)
+ return gcl.ReadFile(file_item, mode)
@staticmethod
def _RightHandSideLinesImpl(affected_files):
@@ -989,7 +989,7 @@ def ScanSubDirs(mask, recursive):
def ParseFiles(args, recursive):
files = []
for arg in args:
- files.extend([('M', file) for file in ScanSubDirs(arg, recursive)])
+ files.extend([('M', f) for f in ScanSubDirs(arg, recursive)])
return files
« gclient.py ('K') | « presubmit_canned_checks.py ('k') | tests/gcl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698