changed rule

This commit is contained in:
Jorijn van der Graaf 2026-10-02 20:42:21 +02:00
commit b51a5bffb0
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
3 changed files with 53 additions and 45 deletions

View file

@ -1,6 +1,6 @@
# Crafter.LintRules
The Catcrafts house-style lint rules for [crafter-build](https://forgejo.catcrafts.net/Catcrafts/Crafter.Build), packaged as one C++ module. Naming conventions, K&R braces, `enum class`, `std::println` over iostream, fixed-width integer types, `std::format` over concatenation, line wrapping, whitespace hygiene and a few AST-backed checks (`const` locals, `constexpr` constants, no `char*`). Most rules are transforms, so `crafter-build format` applies them.
The Catcrafts house-style lint rules for [crafter-build](https://forgejo.catcrafts.net/Catcrafts/Crafter.Build) projects, packaged as one C++ module.
## Use
@ -35,7 +35,7 @@ Suppress a finding with `// lint-disable-next-line <rule>` or a whole file with
| --- | --- | --- |
| `spdx-header` | report | `// SPDX-License-Identifier:` on line 1, `// SPDX-FileCopyrightText:` on line 2, blank line 3 |
| `no-tabs` | report | spaces |
| `naming` | report, AST | PascalCase types, functions, statics and constants; camelCase variables |
| `naming` | report, AST | PascalCase types and functions; camelCase variables, including statics and constants |
| `enum-class` | report | `enum class`, never a plain `enum` |
| `no-iostream-print` | report | `std::println` instead of `std::cout`/`std::cerr` streaming |
| `no-char-pointer` | report, AST | `std::string` / `std::string_view` over `char*` outside C interop |
@ -49,12 +49,4 @@ Suppress a finding with `// lint-disable-next-line <rule>` or a whole file with
| `wrap-join` | transform | join wrapped statements that fit on one line |
| `paren-spacing` | transform | `if (` and `for (`, no space before a call's `(` |
| `trim-trailing-ws` | transform | no trailing whitespace |
| `final-newline` | transform | files end with a newline |
## Tests
`tests/HouseRules` exercises every rule against small inputs. It links crafter-build to run the linter in-process, so it fetches and builds it from git; with a sibling checkout at `../Crafter.Build` use `crafter-build test --local`.
## Building for other targets
The module imports `Crafter.Build`, which only exists for the host. That is all a rule ever needs: rules run inside the crafter-build process that loads your `project.cpp`.
| `final-newline` | transform | files end with a newline |