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

Method check_file_content

ci/lint_cpp/member_style_checker.py:167–229  ·  view source on GitHub ↗

Check file for non-standard member variable naming.

(self, file_content: FileContent)

Source from the content-addressed store, hash-verified

165 return True
166
167 def check_file_content(self, file_content: FileContent) -> list[str]:
168 """Check file for non-standard member variable naming."""
169 violations: list[tuple[int, str]] = []
170 in_multiline_comment = False
171
172 for line_number, line in enumerate(file_content.lines, 1):
173 stripped = line.strip()
174
175 # Track multi-line comment state
176 if "/*" in line:
177 in_multiline_comment = True
178 if "*/" in line:
179 in_multiline_comment = False
180 continue
181
182 # Skip if in multi-line comment
183 if in_multiline_comment:
184 continue
185
186 # Skip single-line comments
187 if stripped.startswith("//"):
188 continue
189
190 # Remove single-line comment portion
191 code_part = line.split("//")[0]
192
193 # Skip empty lines
194 if not code_part.strip():
195 continue
196
197 # Fast first pass: skip complex regex if line doesn't contain
198 # a trailing underscore terminator OR m_ prefix
199 has_trailing_underscore = (
200 "_;" in code_part
201 or "_=" in code_part
202 or "_," in code_part
203 or "_)" in code_part
204 or "_ " in code_part
205 )
206 has_m_underscore = "m_" in code_part
207
208 if not has_trailing_underscore and not has_m_underscore:
209 continue
210
211 # Basic string literal handling
212 if '"' in code_part:
213 code_part = self._STRING_LITERAL_PATTERN.sub('""', code_part)
214
215 # Check for trailing underscore (Google style)
216 if has_trailing_underscore:
217 self._check_trailing_underscore(
218 code_part, stripped, line_number, violations
219 )
220
221 # Check for m_ prefix style
222 if has_m_underscore:
223 self._check_m_underscore(code_part, stripped, line_number, violations)
224

Callers 1

_checkMethod · 0.95

Calls 2

_check_m_underscoreMethod · 0.95

Tested by 1

_checkMethod · 0.76