Increase buffer size to 1 << 16

Also improve camel case script
This commit is contained in:
2025-08-26 22:31:42 -04:00
parent dabead7d6b
commit b6e57f58af
2 changed files with 24 additions and 18 deletions

View File

@@ -42,6 +42,7 @@ def get_modified_lines(filepath):
def check_snake_case_violations(filepath, check_new_only=True):
"""Check for camelCase violations in C++ code."""
violations = []
seen_violations = {} # key: (file, line, col), value: camelCase name
# Get modified lines if checking new code only
modified_lines = get_modified_lines(filepath) if check_new_only else None
@@ -107,17 +108,25 @@ def check_snake_case_violations(filepath, check_new_only=True):
"([a-z0-9])([A-Z])", r"\1_\2", camel_case_name
).lower()
violations.append(
{
"file": filepath,
"line": line_num,
"column": match.start(1) + 1,
"type": violation_type,
"camelCase": camel_case_name,
"snake_case": snake_case,
"context": line.strip(),
}
)
key = (filepath, line_num, match.start(1) + 1)
# Only add if we haven't seen this exact violation before
if (
key not in seen_violations
or seen_violations[key] != camel_case_name
):
seen_violations[key] = camel_case_name
violations.append(
{
"file": filepath,
"line": line_num,
"column": match.start(1) + 1,
"type": violation_type,
"camelCase": camel_case_name,
"snake_case": snake_case,
"context": line.strip(),
}
)
return violations
@@ -145,11 +154,9 @@ def main():
violations = check_snake_case_violations(filepath, args.check_new_code_only)
if violations:
print(f"\n{filepath}:")
for v in violations:
print(
f" Line {v['line']}:{v['column']} - {v['type']} '{v['camelCase']}' should be '{v['snake_case']}'"
)
print(f"\n{filepath}:{v['line']}:{v['column']}")
print(f" {v['type']} '{v['camelCase']}' should be '{v['snake_case']}'")
print(f" Context: {v['context']}")
total_violations += len(violations)