On this page
  1. The tools
  2. Rule by rule
  3. Written down, not checked
  4. Switched off, and why
  5. What the framework still owes
  6. In a game

What checks what

A rule that only a document states lasts until the day somebody has not read the document. So each rule on these pages names the tool that refuses its mistake, and this page puts them in one table, with where each one holds: in the framework (its include/, src/ and tests/), in its examples, and in a game made with rmp new. The build of this site holds the table to the framework's own configuration, so a check that is said to run runs.

The tools#

clang-tidy, which rmp lint runs
The checks of the framework's .clang-tidy over the sources of src/, tests/ and examples/, and the headers they reach, with the flags each file is built with. Whole families run — bugprone, clang-analyzer, performance, portability, misc, modernize, readability — minus what is switched off below, and the style guide's checks are named one by one. Two of them are queries the framework writes itself, which clang-tidy runs only with --experimental-custom-checks, and rmp lint passes it.
examples/.clang-tidy
The same file for the examples, narrowed: it switches off the modernize and readability families, which push a more elaborate spelling of correct code at someone learning raylib, and takes back the ones that are rules of these pages. An example teaches the C++ a game should write.
What the tree still owes
clang-tidy's warnings that the framework has not yet paid are listed in tools/lint_debt.txt, a count per check and file. rmp lint fails on a warning the list does not owe and on a count that grew, and the list only shrinks. A new warning is fixed, or carries a NOLINT with its reason on the line.
The text gates, stages of rmp test
What clang-tidy cannot see, because it parses one branch of every #if or because no check of its says it: tools/naming_check.sh (rules R1 to R8, the naming stage), tools/style_check.sh (S1 to S9, style), tools/ownership_check.sh (O1 to O3, ownership), tools/pointer_check.py, which reads the public headers' declarations (pointers), and tools/cppcheck_check.sh, a second analyser over src/rmp (cppcheck).
.clang-format, which rmp fmt applies
The layout of the code. The framework's CI fails on a file it would change; in a game, rmp fmt formats and rmp fmt check refuses a file it would change, when the game runs them: its rmp test and its CI do not.
The compiler
Every target CMake builds from the framework's sources and a game's is compiled with -Wall -Wextra under GCC and Clang: the desktop and the web, and not Android's or iOS's own projects. The framework's own checks build with RMP_WERROR, which makes a warning an error; a game's warnings stay warnings unless it asks for the same. Designated initialisers out of order are an error everywhere.

Rule by rule#

"Yes" in a column says the rule is checked there; what follows it says how far. A game gets .clang-format and the compiler's flags: rmp lint and the text gates are commands of the framework's own repository, and a game chooses its own checks.

RuleChecked byFrameworkExamplesA game
Names spelled by kind: types, constants, functions and variables, private members, the eight hooksreadability-identifier-namingyesyesno
A local never hides a name around itclang-diagnostic-shadow, which is -Wshadow given to clang-tidyyesyesno
No g_ name, no kName, no underscore touching a dot, no trailing underscore, in every branchtools/naming_check.sh R1 R2 R3 R4 R8yesyesno
Every macro starts with RMP_readability-identifier-naming; tools/naming_check.sh R5 in every branchyesyesno
No constant named like somebody else's macrotools/naming_check.sh R6yesyesno
No retired nametools/naming_check.sh R7yesyesno
The layout: 4 spaces, 90 columns, char *p, no alignment, includes in the order written.clang-formatyes, in CIyes, in CIyes: rmp fmt formats and rmp fmt check refuses, when the game runs them
const on every local that does not change, and on what a pointer points to when nothing writes through itmisc-const-correctnessyesyesno
const on a by-value parameter in the definition, never the declarationreadability-avoid-const-params-in-decls, the declaration's halfyesno: the examples switch readability offno
A constant at namespace scope in a header is inline constexprcustom-rmp-header-constantyesyes, in their own headersno
No raw pointer, outside the C libraries' boundarycustom-rmp-raw-pointeryes, with what tools/lint_debt.txt owesyes, with what tools/lint_debt.txt owesno
No raw pointer and no C string in a declaration a game can nametools/pointer_check.py, against tools/pointer_ratchet.txtyes: include/rmp/nono
Nothing owned by hand: no new, delete, malloc or freecppcoreguidelines-owning-memory, cppcoreguidelines-no-malloc; tools/ownership_check.sh O1 in include/rmp/ and src/rmp/yesyes, the clang-tidy checksno
raylib's Load* and Unload* only in the files that own what they maketools/ownership_check.sh O2yes: include/rmp/ and src/rmp/yesno
A std::optional is checked before it is readbugprone-unchecked-optional-accessyesyesno
A std::string_view never reaches a C function through data()bugprone-suspicious-stringview-data-usageyesyesno
std::array, not a C arraymodernize-avoid-c-arraysyesyesno
static_cast, never a C castmodernize-avoid-c-style-cast; tools/style_check.sh S1 in every branchyesyesno
enum classcppcoreguidelines-use-enum-classyesyesno
nullptr, never NULL or 0modernize-use-nullptr; tools/style_check.sh S2 in every branchyesyesno
No C variadic functionmodernize-avoid-variadic-functionsyes, but for the two behind the said-once warnings, each with its reasonyesno
int, and a fixed width when the size mattersgoogle-runtime-intyesyesno
No long doublegoogle-runtime-floatyesyesno
A one-argument constructor is explicitgoogle-explicit-constructoryes, but for the API's deliberate conversionsyesno
A class that manages something says what its copies docppcoreguidelines-special-member-functionsyesyesno
auto where a cast already names the typemodernize-use-autoyesno: the examples switch modernize offno
using, not typedefmodernize-use-usingyesyesno
std::numbers, not a typed-in constantmodernize-use-std-numbersyesyesno
No using namespacegoogle-build-using-namespaceyesyesno
No unnamed namespace in a headergoogle-build-namespacesyesyesno
No using-declaration at global scope in a headergoogle-global-names-in-headersyesyesno
No overloaded unary &google-runtime-operatoryesyesno
std::make_pair deduces its typesgoogle-build-explicit-make-pairyesyesno
No default argument on a virtual functiongoogle-default-argumentsyesyesno
++i where the old value is not readtools/style_check.sh S6yesyesno
No user-defined literaltools/style_check.sh S5yesyesno
Nothing newer than the oldest compiler a game is built withtools/style_check.sh S4yes, but not in tests/, which build only on CI's compilersyesno
No iostreams in the library: a file is read through C's stdio or raylibtools/style_check.sh S8; one std::ifstream made every release a fifth biggeryes: src/rmp/ and include/rmp/nono
No // comment that ends in a backslash: it takes the next line with ittools/style_check.sh S9; GCC warns about it, Clang and clang-tidy never doyesyesno
cute_aseprite reads only what the framework walked firsttools/ownership_check.sh O3: its two loads only in src/rmp/assets/animation.cppyesyesno
No TODO, FIXME or XXXtools/style_check.sh S3yesyesno
Designated initialisers in declaration order-Werror=reorder-init-list under Clang; GCC and MSVC refuse them anywayyesyesyes
A macro only for what a function cannot docppcoreguidelines-macro-usage, told the framework's own by nameyesyesno
No finding of a second analyser, and a reason beside every suppressiontools/cppcheck_check.shyes: src/rmp/nono
Warnings on the code we write-Wall -Wextrayes, as errors in the framework's checksyesyes, as warnings

Written down, not checked#

Some rules have no tool that can tell the right way from the wrong one. They are questions a reviewer asks:

  • const on a by-value parameter in a definition — clang-tidy does not look at parameters — and constexpr, consteval and constinit wherever they apply (const);
  • a std::array given a size larger than its list, whose rest is filled with zeros (Modern C++);
  • an unsigned type only for bits, and auto beyond a cast (Modern C++);
  • #pragma once at the top of a header, and <filesystem> in src/rmp/app/app.cpp and src/rmp/save/save.cpp only (Google's guide);
  • everything Google's guide says that no check of these pages states.

Switched off, and why#

Each check the framework's .clang-tidy switches off fights a decision the framework has already made, and the file says which next to it. In the same words:

CheckWhy it is off
bugprone-easily-swappable-parametersEvery (float x, float y) in a 2D framework, which is all of them.
bugprone-narrowing-conversionsfloat and int mixing is what raylib's own API does; the static analyser catches the cases that lose data.
misc-non-private-member-variables-in-classesThe options structs and rmp::Object are public data by design (Google's guide).
misc-no-recursionThe layout walk is a tree walk.
misc-include-cleanerIt wants an #include for every raylib symbol, and raylib is one header.
misc-use-anonymous-namespace, misc-use-internal-linkagestatic at file scope is the deliberate spelling: main.cpp is the file a newcomer reads first, and it has a plain C twin among the examples, so the two keep the same shape. Google allows either.
modernize-use-trailing-return-typeauto f() -> int is not the style, nor Google's.
modernize-use-nodiscardIt would decorate the whole API for the few calls where it matters.
modernize-macro-to-enumThe values the .toml generates are macros on purpose: the C entry point reads them too (Macros).
modernize-use-designated-initializersIt suggests them inside the framework's implementation, where the field order is Clay's, not the framework's.
portability-avoid-pragma-once#pragma once is the framework's decision, and every compiler it builds with supports it (Google's guide).
performance-enum-sizePinning an underlying type on a public enum is churn in the ABI for bytes nobody is short of.
readability-redundant-member-initIn an options struct every field shows its default, even where the default is what the type would give anyway, and one field that does not is worse.
readability-use-std-min-maxThe explicit if (dt > 0.1f) clamps are written that way, with a comment saying why the bound is what it is.
readability-use-concise-preprocessor-directives#if defined(A) || defined(B) and #if defined(A) are written the same way on purpose.
readability-identifier-lengthdt, t and o are the vocabulary.
readability-magic-numbersIt is a game, and a touch target is a number: 44.
readability-braces-around-statementsA guard on one line is the style, and .clang-format is set to keep it there (Google's guide).
readability-implicit-bool-conversionraylib returns int for booleans.
readability-function-cognitive-complexityA render switch is one function on purpose (Google's guide).
readability-uppercase-literal-suffix1.0f, not 1.0F.
readability-avoid-nested-conditional-operator, readability-math-missing-parenthesesSwitched off with the others; .clang-tidy gives no reason beside them.

And for the examples, examples/.clang-tidy switches off misc-unused-parameters: a hook takes float delta whether this example's _update uses it or not, and the signature is the API's. It keeps readability-identifier-naming, readability-misleading-indentation and readability-misplaced-array-index from the family it switches off, and these six from modernize, each a rule of these pages: modernize-avoid-c-arrays, modernize-avoid-c-style-cast, modernize-use-nullptr, modernize-avoid-variadic-functions, modernize-use-std-numbers and modernize-use-using.

What the framework still owes#

A rule that arrives after the code it judges finds the code breaking it. The framework writes that down instead of switching the rule off, and each list only shrinks: what clang-tidy still finds is tools/lint_debt.txt; the pointers left in its headers, each with its reason, are tools/pointer_ratchet.txt; the files allowed to own memory or raylib resources by hand, each with its reason, are in tools/ownership_check.sh; and what cppcheck may not say, each with its reason, is in tools/cppcheck_check.sh or on the line itself.

In a game#

A game made with rmp new gets the formatter, rmp fmt, and the compiler's flags, which hold its designated initialisers to their order. None of the rest runs on its code: the rules are the advice the framework follows, and a game that wants to read like it can follow them too, and can switch the framework's clang-tidy on for its own code. What a game gets says the same from the game's side.