If confidence >= verbose, category passes filter and is not suppressed.
(category, confidence, filename, linenum)
| 1855 | |
| 1856 | |
| 1857 | def _ShouldPrintError(category, confidence, filename, linenum): |
| 1858 | """If confidence >= verbose, category passes filter and is not suppressed.""" |
| 1859 | |
| 1860 | # There are three ways we might decide not to print an error message: |
| 1861 | # a "NOLINT(category)" comment appears in the source, |
| 1862 | # the verbosity level isn't high enough, or the filters filter it out. |
| 1863 | if IsErrorSuppressedByNolint(category, linenum): |
| 1864 | return False |
| 1865 | |
| 1866 | if confidence < _cpplint_state.verbose_level: |
| 1867 | return False |
| 1868 | |
| 1869 | is_filtered = False |
| 1870 | for one_filter in _Filters(): |
| 1871 | filter_cat, filter_file, filter_line = _ParseFilterSelector(one_filter[1:]) |
| 1872 | category_match = category.startswith(filter_cat) |
| 1873 | file_match = filter_file in ("", filename) |
| 1874 | line_match = filter_line in (linenum, -1) |
| 1875 | |
| 1876 | if one_filter.startswith("-"): |
| 1877 | if category_match and file_match and line_match: |
| 1878 | is_filtered = True |
| 1879 | elif one_filter.startswith("+"): |
| 1880 | if category_match and file_match and line_match: |
| 1881 | is_filtered = False |
| 1882 | else: |
| 1883 | # should have been checked for in SetFilter. |
| 1884 | msg = f"Invalid filter: {one_filter}" |
| 1885 | raise ValueError(msg) |
| 1886 | return not is_filtered |
| 1887 | |
| 1888 | |
| 1889 | def Error(filename, linenum, category, confidence, message): |
no test coverage detected
searching dependent graphs…