Increase buffer size to 1 << 16
Also improve camel case script
This commit is contained in:
@@ -152,11 +152,10 @@ struct HttpHandler : ConnectionHandler {
|
|||||||
static int onMessageComplete(llhttp_t *parser);
|
static int onMessageComplete(llhttp_t *parser);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr int kFinalStageThreads = 2;
|
static constexpr int lg_size = 16;
|
||||||
static constexpr int kLogSize = 12;
|
|
||||||
StaticThreadPipeline<std::unique_ptr<Connection>,
|
StaticThreadPipeline<std::unique_ptr<Connection>,
|
||||||
WaitStrategy::WaitIfUpstreamIdle, 1, 2>
|
WaitStrategy::WaitIfUpstreamIdle, 1, 2>
|
||||||
pipeline{kLogSize};
|
pipeline{lg_size};
|
||||||
std::thread stage0Thread;
|
std::thread stage0Thread;
|
||||||
std::vector<std::thread> finalStageThreads;
|
std::vector<std::thread> finalStageThreads;
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ def get_modified_lines(filepath):
|
|||||||
def check_snake_case_violations(filepath, check_new_only=True):
|
def check_snake_case_violations(filepath, check_new_only=True):
|
||||||
"""Check for camelCase violations in C++ code."""
|
"""Check for camelCase violations in C++ code."""
|
||||||
violations = []
|
violations = []
|
||||||
|
seen_violations = {} # key: (file, line, col), value: camelCase name
|
||||||
|
|
||||||
# Get modified lines if checking new code only
|
# Get modified lines if checking new code only
|
||||||
modified_lines = get_modified_lines(filepath) if check_new_only else None
|
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
|
"([a-z0-9])([A-Z])", r"\1_\2", camel_case_name
|
||||||
).lower()
|
).lower()
|
||||||
|
|
||||||
violations.append(
|
key = (filepath, line_num, match.start(1) + 1)
|
||||||
{
|
|
||||||
"file": filepath,
|
# Only add if we haven't seen this exact violation before
|
||||||
"line": line_num,
|
if (
|
||||||
"column": match.start(1) + 1,
|
key not in seen_violations
|
||||||
"type": violation_type,
|
or seen_violations[key] != camel_case_name
|
||||||
"camelCase": camel_case_name,
|
):
|
||||||
"snake_case": snake_case,
|
seen_violations[key] = camel_case_name
|
||||||
"context": line.strip(),
|
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
|
return violations
|
||||||
|
|
||||||
@@ -145,11 +154,9 @@ def main():
|
|||||||
violations = check_snake_case_violations(filepath, args.check_new_code_only)
|
violations = check_snake_case_violations(filepath, args.check_new_code_only)
|
||||||
|
|
||||||
if violations:
|
if violations:
|
||||||
print(f"\n❌ {filepath}:")
|
|
||||||
for v in violations:
|
for v in violations:
|
||||||
print(
|
print(f"\n❌ {filepath}:{v['line']}:{v['column']}")
|
||||||
f" Line {v['line']}:{v['column']} - {v['type']} '{v['camelCase']}' should be '{v['snake_case']}'"
|
print(f" {v['type']} '{v['camelCase']}' should be '{v['snake_case']}'")
|
||||||
)
|
|
||||||
print(f" Context: {v['context']}")
|
print(f" Context: {v['context']}")
|
||||||
total_violations += len(violations)
|
total_violations += len(violations)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user