MCPcopy Create free account
hub / github.com/FastLED/FastLED / BareNoInlineChecker

Class BareNoInlineChecker

ci/lint_cpp/bare_noinline_checker.py:72–118  ·  view source on GitHub ↗

Bans bare `noinline` compiler attributes in src/ (#2773 item 2.1 follow-up).

Source from the content-addressed store, hash-verified

70
71
72class BareNoInlineChecker(FileContentChecker):
73 """Bans bare `noinline` compiler attributes in src/ (#2773 item 2.1 follow-up)."""
74
75 def __init__(self):
76 self.violations: dict[str, list[tuple[int, str]]] = {}
77
78 def should_process_file(self, file_path: str) -> bool:
79 if not file_path.startswith(str(SRC_ROOT)):
80 return False
81 if not file_path.endswith((".cpp", ".h", ".hpp")):
82 return False
83 norm = file_path.replace("\\", "/")
84 for exempt in EXEMPT_FILES:
85 if norm.endswith(exempt):
86 return False
87 # Upstream third-party code: not our syntax to enforce.
88 if "/third_party/" in norm:
89 return False
90 return True
91
92 def check_file_content(self, file_content: FileContent) -> list[str]:
93 violations: list[tuple[int, str]] = []
94 in_block_comment = False
95
96 for line_number, line in enumerate(file_content.lines, 1):
97 stripped = line.strip()
98
99 if in_block_comment:
100 if "*/" in line:
101 in_block_comment = False
102 continue
103 if "/*" in line and "*/" not in line:
104 in_block_comment = True
105 continue
106
107 if stripped.startswith("//"):
108 continue
109 if _SUPPRESS in line:
110 continue
111
112 code = line.split("//")[0]
113 if _BANNED_PATTERN.search(code):
114 violations.append((line_number, line.rstrip()))
115
116 if violations:
117 self.violations[file_content.path] = violations
118 return []
119
120
121def main() -> None:

Callers 2

create_checkersFunction · 0.90
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected