Crafter.Build/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jorijn van der Graaf d55657b7ce feat(lint): naming reads the AST, deleting the scope heuristic
The rule was 125 lines: four std::regex, a hand-rolled {/} scope stack, a
cumulative paren-depth counter so a wrapped parameter list would not look like
a declaration, a 40-entry keyword denylist, and a "function-shaped line" guess
whose own comment conceded it was heuristic. Storage class came from
lineStr.contains("static "). It is now ~55 lines that ask clang what kind of
declaration each thing is and what encloses it.

The three regressions the old version carried special cases for — a call with
an inline lambda argument, a bare statement call, a one-liner method — need no
handling at all, because a call is not a declaration. Their tests pass
unchanged.

On this repository the exact version found 42 violations the heuristic had
never been able to see, all real:

  - 37 members of the libclang function-pointer table added two commits ago
    were PascalCase. The old varDecl regex could not match a declaration whose
    type is decltype(&f), so they were silently skipped. Renamed to camelCase,
    which mirrors clang_createIndex -> createIndex more closely anyway.
  - Crafter.Build-Shader.cpp had a snake_case local, file_name_list, invisible
    to the heuristic for the same reason (it declares a const char* array).
  - Four extern "C" declarations of libc functions in tests were reported as
    badly-named functions. Those are named by the C library, so C language
    linkage is now an exemption — the same principled test no-char-pointer
    uses, rather than another denylist entry.

New tests cover what the line-based version structurally could not reach: a
signature wrapped over several lines, `static` on its own line above the
declaration it applies to, and a member versus a local inside a method.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 23:53:26 +02:00
..
CleanProject fix: key the host PCM cache on source content, add clean, hash project args 2026-07-30 17:43:09 +00:00
ConcurrentCacheRace linting 2026-07-23 01:24:42 +02:00
ConcurrentDependencyReset linting 2026-07-23 01:24:42 +02:00
DependencyLink linting 2026-07-23 01:24:42 +02:00
HelloWorld linting 2026-07-23 01:24:42 +02:00
HostCacheSourceStamp fix: key the host PCM cache on source content, add clean, hash project args 2026-07-30 17:43:09 +00:00
HouseRules feat(lint): naming reads the AST, deleting the scope heuristic 2026-07-30 23:53:26 +02:00
IncrementalInterfaceChange fix: re-resolve module imports before checking staleness 2026-07-30 17:12:24 +00:00
Lint feat(lint): AST layer over libclang cursors 2026-07-30 23:30:41 +02:00
ModuleInterface linting 2026-07-23 01:24:42 +02:00
RunSingleTestExit linting 2026-07-23 01:24:42 +02:00
ShaderCompile linting 2026-07-23 01:24:42 +02:00
StandardArgs fix: key the host PCM cache on source content, add clean, hash project args 2026-07-30 17:43:09 +00:00
StaticLib linting 2026-07-23 01:24:42 +02:00
TestRunnerSpec linting 2026-07-23 01:24:42 +02:00
TransitiveInterfaceChange fix: track what a primary module interface imports 2026-07-30 18:19:04 +00:00
VariantId fix: key the host PCM cache on source content, add clean, hash project args 2026-07-30 17:43:09 +00:00
WasiBrowserRuntime linting 2026-07-23 01:24:42 +02:00
WasmVariants linting 2026-07-23 01:24:42 +02:00