Arasaka.HouseRules.Analyzers 1.0.4
HouseRules
The owner's development rules as one catalogue (RULES.md) and one Roslyn analyzer package,
Arasaka.HouseRules.Analyzers, on https://nget.thepra.dev/v3/index.json. Every project the owner wrote adopts the
rules that apply to it, writes them against its own types in its own docs, and builds with the analyzer, so a broken rule
shows in Rider as you type and fails the build once the project is clean.
Adopting it
<!-- Directory.Packages.props (central package management) -->
<GlobalPackageReference Include="Arasaka.HouseRules.Analyzers" Version="1.0.0" />
<!-- or Directory.Build.props without it -->
<PackageReference Include="Arasaka.HouseRules.Analyzers" Version="1.0.0" PrivateAssets="all" />
nuget.config maps Arasaka.* to nget. The project's Directory.Build.props sets what only it knows:
| Property | Meaning | Example |
|---|---|---|
HouseRulesDtoNamespaces |
namespaces whose types are DTOs (HR0010 runs only here) | Sintopia.Shared |
HouseRulesFormatHelpers |
types allowed to format numbers by hand (HR0011) | NumbersExtensions |
HouseRulesTailwindPrefix |
Tailwind prefix, when there is one (HR0201) | tw |
HouseRulesCancellationExempt |
more base types or interfaces whose async methods take no token (HR0003) | Avalonia.Controls.Control |
HouseRulesHttpContextAllowed |
more types allowed to inject IHttpContextAccessor (HR0008) |
AuditMiddleware |
HouseRulesAutocompleteOmit |
.razor file names whose inputs omit autocomplete (login, contact) |
Login.razor |
Severities come from the package's house-rules.globalconfig (every HR rule a warning, plus IDE0007). A project
raises them with <WarningsAsErrors> once it reports none, and lowers one in its own .editorconfig only with a reason in
its docs. A single deliberate exception is
[SuppressMessage("HouseRules", "HR0007", Justification = "Stripe retries on 5xx")], listed in the project's docs.
.razor and .cshtml files reach the analyzer as AdditionalFiles (the Razor SDK passes them), so the markup rules need
no extra setup. C# inside @code and markup expressions is checked through the generated code, and the diagnostic
points at the .razor line.
Releasing
tools/check.sh # packs, builds samples/Violations against samples/expected.txt, samples/Clean must be silent
git tag house-rules-v1.0.0 && git push origin house-rules-v1.0.0
The Package workflow runs the same check, packs the version from the tag and pushes it to nget.
No packages depend on Arasaka.HouseRules.Analyzers.