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

Function CheckAccess

rtpose_wrapper/scripts/cpp_lint.py:2486–2514  ·  view source on GitHub ↗

Checks for improper use of DISALLOW* macros. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. nesting_state: A _NestingState instance which maintains information about

(filename, clean_lines, linenum, nesting_state, error)

Source from the content-addressed store, hash-verified

2484 'TODO(my_username) should be followed by a space')
2485
2486def CheckAccess(filename, clean_lines, linenum, nesting_state, error):
2487 """Checks for improper use of DISALLOW* macros.
2488
2489 Args:
2490 filename: The name of the current file.
2491 clean_lines: A CleansedLines instance containing the file.
2492 linenum: The number of the line to check.
2493 nesting_state: A _NestingState instance which maintains information about
2494 the current stack of nested blocks being parsed.
2495 error: The function to call with any errors found.
2496 """
2497 line = clean_lines.elided[linenum] # get rid of comments and strings
2498
2499 matched = Match((r'\s*(DISALLOW_COPY_AND_ASSIGN|'
2500 r'DISALLOW_EVIL_CONSTRUCTORS|'
2501 r'DISALLOW_IMPLICIT_CONSTRUCTORS)'), line)
2502 if not matched:
2503 return
2504 if nesting_state.stack and isinstance(nesting_state.stack[-1], _ClassInfo):
2505 if nesting_state.stack[-1].access != 'private':
2506 error(filename, linenum, 'readability/constructors', 3,
2507 '%s must be in the private: section' % matched.group(1))
2508
2509 else:
2510 # Found DISALLOW* macro outside a class declaration, or perhaps it
2511 # was used inside a function when it should have been part of the
2512 # class declaration. We could issue a warning here, but it
2513 # probably resulted in a compiler error already.
2514 pass
2515
2516
2517def FindNextMatchingAngleBracket(clean_lines, linenum, init_suffix):

Callers 1

CheckStyleFunction · 0.85

Calls 2

MatchFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected