Logs the fact we've found a lint error. We log where the error was found, and also our confidence in the error, that is, how certain we are this is a legitimate style regression, and not a misidentification or a use that's sometimes justified. False positives can be suppressed by the use o
(filename, linenum, category, confidence, message)
| 850 | |
| 851 | |
| 852 | def Error(filename, linenum, category, confidence, message): |
| 853 | """Logs the fact we've found a lint error. |
| 854 | |
| 855 | We log where the error was found, and also our confidence in the error, |
| 856 | that is, how certain we are this is a legitimate style regression, and |
| 857 | not a misidentification or a use that's sometimes justified. |
| 858 | |
| 859 | False positives can be suppressed by the use of |
| 860 | "cpplint(category)" comments on the offending line. These are |
| 861 | parsed into _error_suppressions. |
| 862 | |
| 863 | Args: |
| 864 | filename: The name of the file containing the error. |
| 865 | linenum: The number of the line containing the error. |
| 866 | category: A string used to describe the "category" this bug |
| 867 | falls under: "whitespace", say, or "runtime". Categories |
| 868 | may have a hierarchy separated by slashes: "whitespace/indent". |
| 869 | confidence: A number from 1-5 representing a confidence score for |
| 870 | the error, with 5 meaning that we are certain of the problem, |
| 871 | and 1 meaning that it could be a legitimate construct. |
| 872 | message: The error message. |
| 873 | """ |
| 874 | if _ShouldPrintError(category, confidence, linenum): |
| 875 | _cpplint_state.IncrementErrorCount(category) |
| 876 | if _cpplint_state.output_format == 'vs7': |
| 877 | sys.stderr.write('%s(%s): %s [%s] [%d]\n' % ( |
| 878 | filename, linenum, message, category, confidence)) |
| 879 | elif _cpplint_state.output_format == 'eclipse': |
| 880 | sys.stderr.write('%s:%s: warning: %s [%s] [%d]\n' % ( |
| 881 | filename, linenum, message, category, confidence)) |
| 882 | else: |
| 883 | sys.stderr.write('%s:%s: %s [%s] [%d]\n' % ( |
| 884 | filename, linenum, message, category, confidence)) |
| 885 | |
| 886 | |
| 887 | # Matches standard C++ escape esequences per 2.13.2.3 of the C++ standard. |
no test coverage detected