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

Side by Side Diff: gcl.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cpplint_chromium.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """\ 6 """\
7 Wrapper script around Rietveld's upload.py that simplifies working with groups 7 Wrapper script around Rietveld's upload.py that simplifies working with groups
8 of files. 8 of files.
9 """ 9 """
10 10
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 1176
1177 1177
1178 @need_change_and_args 1178 @need_change_and_args
1179 def CMDlint(change_info, args): 1179 def CMDlint(change_info, args):
1180 """Runs cpplint.py on all the files in the change list. 1180 """Runs cpplint.py on all the files in the change list.
1181 1181
1182 Checks all the files in the changelist for possible style violations. 1182 Checks all the files in the changelist for possible style violations.
1183 """ 1183 """
1184 try: 1184 try:
1185 import cpplint 1185 import cpplint
1186 import cpplint_chromium
1186 except ImportError: 1187 except ImportError:
1187 ErrorExit("You need to install cpplint.py to lint C++ files.") 1188 ErrorExit("You need to install cpplint.py to lint C++ files.")
1188 # Change the current working directory before calling lint so that it 1189 # Change the current working directory before calling lint so that it
1189 # shows the correct base. 1190 # shows the correct base.
1190 previous_cwd = os.getcwd() 1191 previous_cwd = os.getcwd()
1191 os.chdir(change_info.GetLocalRoot()) 1192 os.chdir(change_info.GetLocalRoot())
1192 # Process cpplints arguments if any. 1193 # Process cpplints arguments if any.
1193 filenames = cpplint.ParseArguments(args + change_info.GetFileNames()) 1194 filenames = cpplint.ParseArguments(args + change_info.GetFileNames())
1194 1195
1195 white_list = GetCodeReviewSetting("LINT_REGEX") 1196 white_list = GetCodeReviewSetting("LINT_REGEX")
1196 if not white_list: 1197 if not white_list:
1197 white_list = DEFAULT_LINT_REGEX 1198 white_list = DEFAULT_LINT_REGEX
1198 white_regex = re.compile(white_list) 1199 white_regex = re.compile(white_list)
1199 black_list = GetCodeReviewSetting("LINT_IGNORE_REGEX") 1200 black_list = GetCodeReviewSetting("LINT_IGNORE_REGEX")
1200 if not black_list: 1201 if not black_list:
1201 black_list = DEFAULT_LINT_IGNORE_REGEX 1202 black_list = DEFAULT_LINT_IGNORE_REGEX
1202 black_regex = re.compile(black_list) 1203 black_regex = re.compile(black_list)
1204 extra_check_functions = [cpplint_chromium.CheckPointerDeclarationWhitespace]
1203 # Access to a protected member _XX of a client class 1205 # Access to a protected member _XX of a client class
1204 # pylint: disable=W0212 1206 # pylint: disable=W0212
1205 for filename in filenames: 1207 for filename in filenames:
1206 if white_regex.match(filename): 1208 if white_regex.match(filename):
1207 if black_regex.match(filename): 1209 if black_regex.match(filename):
1208 print "Ignoring file %s" % filename 1210 print "Ignoring file %s" % filename
1209 else: 1211 else:
1210 cpplint.ProcessFile(filename, cpplint._cpplint_state.verbose_level) 1212 cpplint.ProcessFile(filename, cpplint._cpplint_state.verbose_level,
1213 extra_check_functions)
1211 else: 1214 else:
1212 print "Skipping file %s" % filename 1215 print "Skipping file %s" % filename
1213 1216
1214 print "Total errors found: %d\n" % cpplint._cpplint_state.error_count 1217 print "Total errors found: %d\n" % cpplint._cpplint_state.error_count
1215 os.chdir(previous_cwd) 1218 os.chdir(previous_cwd)
1216 return 1 1219 return 1
1217 1220
1218 1221
1219 def DoPresubmitChecks(change_info, committing, may_prompt): 1222 def DoPresubmitChecks(change_info, committing, may_prompt):
1220 """Imports presubmit, then calls presubmit.DoPresubmitChecks.""" 1223 """Imports presubmit, then calls presubmit.DoPresubmitChecks."""
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 raise 1463 raise
1461 print >> sys.stderr, ( 1464 print >> sys.stderr, (
1462 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1465 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1463 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) 1466 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))
1464 return 1 1467 return 1
1465 1468
1466 1469
1467 if __name__ == "__main__": 1470 if __name__ == "__main__":
1468 fix_encoding.fix_encoding() 1471 fix_encoding.fix_encoding()
1469 sys.exit(main(sys.argv[1:])) 1472 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « cpplint_chromium.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698