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

Unified Diff: development/release/linux/gcl.py

Issue 18138: Allows cpplints arguments to be used within gcl.... (Closed) Base URL: http://src.chromium.org/svn/trunk/depot_tools/
Patch Set: Created 11 years, 11 months 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
« no previous file with comments | « no previous file | development/release/mac/gcl.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: development/release/linux/gcl.py
===================================================================
--- development/release/linux/gcl.py (revision 8160)
+++ development/release/linux/gcl.py (working copy)
@@ -728,23 +728,30 @@
# Valid extensions for files we want to lint.
CPP_EXTENSIONS = ("cpp", "cc", "h")
-def Lint(change_info):
+def Lint(change_info, args):
"""Runs cpplint.py on all the files in |change_info|"""
try:
import cpplint
except ImportError:
ErrorExit("You need to install cpplint.py to lint C++ files.")
- for file_record in change_info.files:
- file = file_record[1]
+ # Change the current working directory before calling lint so that it
+ # shows the correct base.
+ os.chdir(GetRepositoryRoot())
+ # Process cpplints arguments if any.
+ filenames = cpplint.ParseArguments(args + change_info.FileList())
+
+ for file in filenames:
if len([file for suffix in CPP_EXTENSIONS if file.endswith(suffix)]):
if len([file for prefix in IGNORE_PATHS if file.startswith(prefix)]):
print "Ignoring non-Google styled file %s" % file
else:
- cpplint.ProcessFile(file, 0)
+ cpplint.ProcessFile(file, cpplint._cpplint_state.verbose_level)
+ print "Total errors found: %d\n" % cpplint._cpplint_state.error_count
+
def Changes():
"""Print all the changlists and their files."""
for cl in GetCLs():
@@ -811,7 +818,7 @@
if command == "change":
Change(change_info)
elif command == "lint":
- Lint(change_info)
+ Lint(change_info, argv[3:])
elif command == "upload":
UploadCL(change_info, argv[3:])
elif command == "commit":
« no previous file with comments | « no previous file | development/release/mac/gcl.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698