| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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() |
| OLD | NEW |