refactor: pull the house-style rules from Crafter.LintRules instead of a copied header

lint-rules.h moves to its own repo as the module Crafter.LintRules, which
project.cpp now imports through `#pragma crafter dependency`. Editing a
rule no longer needs `touch project.cpp`: the rebuilt dependency makes
project.so stale by itself. tests/HouseRules moves with the rules.

Building this checkout needs a crafter-build that understands the
directive (`./build.sh` bootstraps one) and the Crafter.LintRules repo on
Forgejo.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Jorijn van der Graaf 2026-10-02 20:03:22 +02:00
commit 825cc875ad
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
4 changed files with 7 additions and 1491 deletions

View file

@ -3,7 +3,8 @@
import std;
import Crafter.Build;
#include "lint-rules.h"
#pragma crafter dependency "https://forgejo.catcrafts.net/Catcrafts/Crafter.LintRules.git"
import Crafter.LintRules;
namespace fs = std::filesystem;
using namespace Crafter;
@ -132,13 +133,12 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
.LinkFlag("-Wl,--export-dynamic").LinkFlag("-ldl");
cfg.AddTest("ConcurrentDependencyReset").Dependencies({ CrafterBuildLib.get() });
cfg.AddTest("Lint").Dependencies({ CrafterBuildLib.get() });
cfg.AddTest("HouseRules").Dependencies({ CrafterBuildLib.get() });
}
// Dogfood: this repo's house-style rules (see lint-rules.h). Report
// rules gate `crafter-build lint`; transform rules also auto-fix under
// `crafter-build format`.
ProjectLint::AddProjectLintRules(cfg);
// Dogfood: the house-style rules, imported from their own repo through
// the pragma above. Report rules gate `crafter-build lint`; transform
// rules also auto-fix under `crafter-build format`.
LintRules::AddRules(cfg);
return cfg;
}