Skip to content

lint: discover projects instead of listing them - #50

Merged
ResurrectedTrader merged 1 commit into
mainfrom
lint-layout-agnostic
Sep 26, 2026
Merged

ResurrectedTrader merged 1 commit into
mainfrom
lint-layout-agnostic

Conversation

@ResurrectedTrader

Copy link
Copy Markdown
Owner

scripts/lint.ps1 kept the project layout in hand-maintained lists (compile-database paths, a file glob per project, the databases loaded for cache keys, the .clang-tidy configs, the vendored header trees), and build.ps1 fix kept another copy. They had drifted:

  • services was never cached. It was missing from the databases loaded for cache keys, so its files were never dependency-scanned and were re-linted on every run.
  • V8 changes never invalidated the cache. The fingerprint pointed at dependencies\v8\include, which no longer exists.
  • fix skipped the tests.

This derives everything from the projects instead:

  • Projects: every .vcxproj under src\ and tests\. Each is linted on Win32 when it has a Win32 configuration, otherwise on the platform it has. A missing or stale compile database regenerates each platform that needs it.
  • Files and commands: read from each project's own compile database. A source compiled by several projects (the tests build Pathfinder.cpp) is linted once, with the project whose directory holds it. That is the same 119 files as before.
  • Cache invalidation: a project header is anything inside a project directory. Every include directory outside one (V8, D2MOO, the vcpkg install) is fingerprinted into the environment token, as is every .clang-tidy and vcpkg.json. None of those trees is linted; they only invalidate the cache.
  • build.ps1 fix: runs lint.ps1 -Fix over the same file set.

It also fixes header caching. The dependency scan attributed each rule to the first .cpp path it named, so a unit whose main file is a header was never cached. Rules are now matched against the files that were scanned.

Adding a project (a second backend, another glue DLL) now needs no lint changes.

Testing

  • Cold run: databases regenerated from scratch, then 119 files linted, 119 passed, in 3:30.
  • Warm run: 119 of 119 cached, 1 s. That includes services, which previously re-ran every time.
  • Invalidation: editing services/update/UpdateChecker.h re-linted exactly the 3 files that include it; the other 116 came from the cache.
  • Header unit: a scan whose main file is a header now gets its dependency entry.
  • Vendored fingerprints: they cover V8 (113 headers), D2MOO and vcpkg (227 headers), and computing the token takes about 0.1 s.
  • build.ps1 fix: discovers the same files and applies fixes. I stopped the smoke test after a few files; nothing changed.

🤖 Generated with Claude Code

scripts/lint.ps1 kept the project layout in hand-maintained lists - the
compile-database paths, a file glob per project, the databases loaded for
cache keys, the .clang-tidy configs and the vendored header trees - and
build.ps1's fix target kept another copy. The lists had drifted:

- services was missing from the databases loaded for cache keys, so its
  files were never dependency-scanned and were re-linted on every run;
- the V8 fingerprint pointed at dependencies\v8\include, which no longer
  exists, so a V8 header change never invalidated the cache;
- fix did not cover the tests.

Everything is now derived from the projects themselves:

- every .vcxproj under src\ and tests\ is a project, linted on Win32 when
  it has a Win32 configuration and otherwise on the platform it has; a
  stale or missing database regenerates each platform that needs it;
- the files linted and their commands come from each project's own
  compile database, a shared source going to the project that holds it
  (the same 119 files as before);
- project headers are anything inside a project directory; every include
  directory outside one (V8, D2MOO, the vcpkg install) is fingerprinted
  into the environment token, as is every .clang-tidy and vcpkg.json;
- build.ps1 fix runs lint.ps1 -Fix over the same file set.

The dependency scan also attributed each rule to the first .cpp path it
named, so a unit whose main file is a header was never cached. Rules are
now matched against the files that were scanned.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ResurrectedTrader
ResurrectedTrader merged commit 8eecdea into main Sep 26, 2026
1 check passed
@ResurrectedTrader
ResurrectedTrader deleted the lint-layout-agnostic branch September 26, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant