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

Side by Side Diff: cpplint.py

Issue 16140002: Added cpplint.py output format for eclipse (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « no previous file | 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 # 2 #
3 # Copyright (c) 2009 Google Inc. All rights reserved. 3 # Copyright (c) 2009 Google Inc. All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 confidence: A number from 1-5 representing a confidence score for 809 confidence: A number from 1-5 representing a confidence score for
810 the error, with 5 meaning that we are certain of the problem, 810 the error, with 5 meaning that we are certain of the problem,
811 and 1 meaning that it could be a legitimate construct. 811 and 1 meaning that it could be a legitimate construct.
812 message: The error message. 812 message: The error message.
813 """ 813 """
814 if _ShouldPrintError(category, confidence, linenum): 814 if _ShouldPrintError(category, confidence, linenum):
815 _cpplint_state.IncrementErrorCount(category) 815 _cpplint_state.IncrementErrorCount(category)
816 if _cpplint_state.output_format == 'vs7': 816 if _cpplint_state.output_format == 'vs7':
817 sys.stderr.write('%s(%s): %s [%s] [%d]\n' % ( 817 sys.stderr.write('%s(%s): %s [%s] [%d]\n' % (
818 filename, linenum, message, category, confidence)) 818 filename, linenum, message, category, confidence))
819 elif _cpplint_state.output_format == 'eclipse':
820 sys.stderr.write('%s:%s: warning: %s [%s] [%d]\n' % (
821 filename, linenum, message, category, confidence))
819 else: 822 else:
820 sys.stderr.write('%s:%s: %s [%s] [%d]\n' % ( 823 sys.stderr.write('%s:%s: %s [%s] [%d]\n' % (
821 filename, linenum, message, category, confidence)) 824 filename, linenum, message, category, confidence))
822 825
823 826
824 # Matches standard C++ escape esequences per 2.13.2.3 of the C++ standard. 827 # Matches standard C++ escape esequences per 2.13.2.3 of the C++ standard.
825 _RE_PATTERN_CLEANSE_LINE_ESCAPES = re.compile( 828 _RE_PATTERN_CLEANSE_LINE_ESCAPES = re.compile(
826 r'\\([abfnrtv?"\\\']|\d+|x[0-9a-fA-F]+)') 829 r'\\([abfnrtv?"\\\']|\d+|x[0-9a-fA-F]+)')
827 # Matches strings. Escape codes should already be removed by ESCAPES. 830 # Matches strings. Escape codes should already be removed by ESCAPES.
828 _RE_PATTERN_CLEANSE_LINE_DOUBLE_QUOTES = re.compile(r'"[^"]*"') 831 _RE_PATTERN_CLEANSE_LINE_DOUBLE_QUOTES = re.compile(r'"[^"]*"')
(...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 3310
3308 verbosity = _VerboseLevel() 3311 verbosity = _VerboseLevel()
3309 output_format = _OutputFormat() 3312 output_format = _OutputFormat()
3310 filters = '' 3313 filters = ''
3311 counting_style = '' 3314 counting_style = ''
3312 3315
3313 for (opt, val) in opts: 3316 for (opt, val) in opts:
3314 if opt == '--help': 3317 if opt == '--help':
3315 PrintUsage(None) 3318 PrintUsage(None)
3316 elif opt == '--output': 3319 elif opt == '--output':
3317 if not val in ('emacs', 'vs7'): 3320 if not val in ('emacs', 'vs7', 'eclipse'):
3318 PrintUsage('The only allowed output formats are emacs and vs7.') 3321 PrintUsage('The only allowed output formats are emacs, vs7 and eclipse.' )
3319 output_format = val 3322 output_format = val
3320 elif opt == '--verbose': 3323 elif opt == '--verbose':
3321 verbosity = int(val) 3324 verbosity = int(val)
3322 elif opt == '--filter': 3325 elif opt == '--filter':
3323 filters = val 3326 filters = val
3324 if not filters: 3327 if not filters:
3325 PrintCategories() 3328 PrintCategories()
3326 elif opt == '--counting': 3329 elif opt == '--counting':
3327 if val not in ('total', 'toplevel', 'detailed'): 3330 if val not in ('total', 'toplevel', 'detailed'):
3328 PrintUsage('Valid counting options are total, toplevel, and detailed') 3331 PrintUsage('Valid counting options are total, toplevel, and detailed')
(...skipping 23 matching lines...) Expand all
3352 _cpplint_state.ResetErrorCounts() 3355 _cpplint_state.ResetErrorCounts()
3353 for filename in filenames: 3356 for filename in filenames:
3354 ProcessFile(filename, _cpplint_state.verbose_level) 3357 ProcessFile(filename, _cpplint_state.verbose_level)
3355 _cpplint_state.PrintErrorCounts() 3358 _cpplint_state.PrintErrorCounts()
3356 3359
3357 sys.exit(_cpplint_state.error_count > 0) 3360 sys.exit(_cpplint_state.error_count > 0)
3358 3361
3359 3362
3360 if __name__ == '__main__': 3363 if __name__ == '__main__':
3361 main() 3364 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698