MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / ParseNolintSuppressions

Function ParseNolintSuppressions

rtpose_wrapper/scripts/cpp_lint.py:464–492  ·  view source on GitHub ↗

Updates the global list of error-suppressions. Parses any NOLINT comments on the current line, updating the global error_suppressions store. Reports an error if the NOLINT comment was malformed. Args: filename: str, the name of the input file. raw_line: str, the line of input text

(filename, raw_line, linenum, error)

Source from the content-addressed store, hash-verified

462_valid_extensions = set(['cc', 'h', 'cpp', 'hpp', 'cu', 'cuh'])
463
464def ParseNolintSuppressions(filename, raw_line, linenum, error):
465 """Updates the global list of error-suppressions.
466
467 Parses any NOLINT comments on the current line, updating the global
468 error_suppressions store. Reports an error if the NOLINT comment
469 was malformed.
470
471 Args:
472 filename: str, the name of the input file.
473 raw_line: str, the line of input text, with comments.
474 linenum: int, the number of the current line.
475 error: function, an error handler.
476 """
477 # FIXME(adonovan): "NOLINT(" is misparsed as NOLINT(*).
478 matched = _RE_SUPPRESSION.search(raw_line)
479 if matched:
480 if matched.group(1) == '_NEXT_LINE':
481 linenum += 1
482 category = matched.group(2)
483 if category in (None, '(*)'): # => "suppress all"
484 _error_suppressions.setdefault(None, set()).add(linenum)
485 else:
486 if category.startswith('(') and category.endswith(')'):
487 category = category[1:-1]
488 if category in _ERROR_CATEGORIES:
489 _error_suppressions.setdefault(category, set()).add(linenum)
490 else:
491 error(filename, linenum, 'readability/nolint', 5,
492 'Unknown NOLINT error category: %s' % category)
493
494
495def ResetNolintSuppressions():

Callers 2

CheckForHeaderGuardFunction · 0.85
ProcessLineFunction · 0.85

Calls 2

errorFunction · 0.85
addMethod · 0.80

Tested by

no test coverage detected