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

Unified Diff: cpplint.py

Issue 7834045: Add lint check against "Foo *bar" and "Foo &bar" declarations. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: '' Created 9 years, 3 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 | cpplint_chromium.py » ('j') | cpplint_chromium.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cpplint.py
===================================================================
--- cpplint.py (revision 99952)
+++ cpplint.py (working copy)
@@ -2898,7 +2898,7 @@
def ProcessLine(filename, file_extension,
clean_lines, line, include_state, function_state,
- class_state, error):
+ class_state, error, extra_check_functions=[]):
"""Processes a single line in the file.
Args:
@@ -2926,9 +2926,11 @@
class_state, error)
CheckPosixThreading(filename, clean_lines, line, error)
CheckInvalidIncrement(filename, clean_lines, line, error)
+ for check_fn in extra_check_functions:
+ check_fn(filename, clean_lines, line, error)
-
-def ProcessFileData(filename, file_extension, lines, error):
+def ProcessFileData(filename, file_extension, lines, error,
+ extra_check_functions=[]):
"""Performs lint checks and reports any errors to the given error function.
Args:
@@ -2956,7 +2958,8 @@
clean_lines = CleansedLines(lines)
for line in xrange(clean_lines.NumLines()):
ProcessLine(filename, file_extension, clean_lines, line,
- include_state, function_state, class_state, error)
+ include_state, function_state, class_state, error,
+ extra_check_functions)
class_state.CheckFinished(filename, error)
CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
@@ -2967,7 +2970,7 @@
CheckForNewlineAtEOF(filename, lines, error)
-def ProcessFile(filename, vlevel):
+def ProcessFile(filename, vlevel, extra_check_functions=[]):
"""Does google-lint on a single file.
Args:
@@ -3019,7 +3022,8 @@
and file_extension != 'cpp'):
sys.stderr.write('Ignoring %s; not a .cc or .h file\n' % filename)
else:
- ProcessFileData(filename, file_extension, lines, Error)
+ ProcessFileData(filename, file_extension, lines, Error,
+ extra_check_functions)
if carriage_return_found and os.linesep != '\r\n':
# Use 0 for linenum since outputing only one error for potentially
# several lines.
« no previous file with comments | « no previous file | cpplint_chromium.py » ('j') | cpplint_chromium.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698