If confidence >= verbose, category passes filter and is not suppressed.
(category, confidence, filename, linenum)
| 1810 | |
| 1811 | |
| 1812 | def _ShouldPrintError(category, confidence, filename, linenum): |
| 1813 | """If confidence >= verbose, category passes filter and is not suppressed.""" |
| 1814 | |
| 1815 | # There are three ways we might decide not to print an error message: |
| 1816 | # a "NOLINT(category)" comment appears in the source, |
| 1817 | # the verbosity level isn't high enough, or the filters filter it out. |
| 1818 | if IsErrorSuppressedByNolint(category, linenum): |
| 1819 | return False |
| 1820 | |
| 1821 | if confidence < _cpplint_state.verbose_level: |
| 1822 | return False |
| 1823 | |
| 1824 | is_filtered = False |
| 1825 | for one_filter in _Filters(): |
| 1826 | filter_cat, filter_file, filter_line = _ParseFilterSelector(one_filter[1:]) |
| 1827 | category_match = category.startswith(filter_cat) |
| 1828 | file_match = filter_file in ("", filename) |
| 1829 | line_match = filter_line in (linenum, -1) |
| 1830 | |
| 1831 | if one_filter.startswith("-"): |
| 1832 | if category_match and file_match and line_match: |
| 1833 | is_filtered = True |
| 1834 | elif one_filter.startswith("+"): |
| 1835 | if category_match and file_match and line_match: |
| 1836 | is_filtered = False |
| 1837 | else: |
| 1838 | # should have been checked for in SetFilter. |
| 1839 | msg = f"Invalid filter: {one_filter}" |
| 1840 | raise ValueError(msg) |
| 1841 | return not is_filtered |
| 1842 | |
| 1843 | |
| 1844 | def Error(filename, linenum, category, confidence, message): |
no test coverage detected