project.cpp: take the lint rules from Crafter.LintRules

lint-rules.h was a project-local copy of the Catcrafts house-style
rules. The rules have their own repository now, and project.cpp imports
them from it (`#pragma crafter dependency`), as Crafter.Build's own
project.cpp does. The dependency is pinned to a commit; crafter-build
clones it whenever it loads project.cpp, so every build fetches it,
CI's included.

The tree does not pass the shared rules yet: `crafter-build lint`
reports 72 findings where the copy reported 20. The shared `naming`
wants camelCase constants and statics (44), `const-local` is new (10),
and `single-declaration` reports two files the copy did not. They are
left for a later change; CI does not run lint.

Tested: build-package.sh run end to end on this commit in a privileged
alpine:edge container (podman) on the workstation, and `crafter-build
lint` on a built copy of this commit.
This commit is contained in:
Jorijn van der Graaf 2026-10-06 16:45:44 +02:00
commit af5b98ec8b
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
3 changed files with 48 additions and 885 deletions

View file

@ -4,7 +4,8 @@
// lint-disable-file no-char-pointer
import std;
import Crafter.Build;
#include "lint-rules.h"
#pragma crafter dependency "https://forgejo.catcrafts.net/Catcrafts/Crafter.LintRules.git" commit "e906f797da2cd0b1776dd1b420f9b04d3cd24baf"
import Crafter.LintRules;
namespace fs = std::filesystem;
using namespace Crafter;
@ -113,7 +114,7 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
ofonod.GetInterfacesAndImplementations(ifaces, impls);
}
ApplyGioFlags(ofonod);
ProjectLint::AddProjectLintRules(ofonod);
LintRules::AddRules(ofonod);
return ofonod;
}
if (wantDialerd) {
@ -129,7 +130,7 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
dialerd.GetInterfacesAndImplementations(ifaces, impls);
}
ApplyGioFlags(dialerd);
ProjectLint::AddProjectLintRules(dialerd);
LintRules::AddRules(dialerd);
return dialerd;
}
if (wantMedia) {
@ -146,7 +147,7 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
}
media.linkFlags.push_back("-ldl"); // dlopen the AMR-WB codecs
media.linkFlags.push_back("-lpthread"); // std::jthread playout/mic
ProjectLint::AddProjectLintRules(media);
LintRules::AddRules(media);
return media;
}
@ -201,7 +202,7 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
cfg.AddTest("Sip").Dependencies({ Core.get() });
cfg.AddTest("Sdp").Dependencies({ Core.get() });
ProjectLint::AddProjectLintRules(cfg);
LintRules::AddRules(cfg);
return cfg;
}