Crafter.Build/implementations
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
..
Crafter.Build-Asset.cpp linting 2026-07-23 01:24:42 +02:00
Crafter.Build-Clang.cpp feat(lint): no-char-pointer reads the AST, retiring the interop denylist 2026-07-30 23:46:32 +02:00
Crafter.Build-External.cpp feat(lint): no-char-pointer reads the AST, retiring the interop denylist 2026-07-30 23:46:32 +02:00
Crafter.Build-Implementation.cpp linting 2026-07-23 01:24:42 +02:00
Crafter.Build-Interface.cpp fix: track what a primary module interface imports 2026-07-30 18:19:04 +00:00
Crafter.Build-Lint.cpp feat(lint): naming reads the AST, deleting the scope heuristic 2026-07-30 23:53:26 +02:00
Crafter.Build-Platform.cpp fix: key the host PCM cache on source content, add clean, hash project args 2026-07-30 17:43:09 +00:00
Crafter.Build-Progress.cpp linting 2026-07-23 01:24:42 +02:00
Crafter.Build-Shader.cpp feat(lint): naming reads the AST, deleting the scope heuristic 2026-07-30 23:53:26 +02:00
Crafter.Build-Test.cpp fix: key the host PCM cache on source content, add clean, hash project args 2026-07-30 17:43:09 +00:00
main.cpp linting 2026-07-23 01:24:42 +02:00