xstylev1.0.0
ConceptsConcepts

The libutils rulesLes règles libutils

When the LU rules are on, and what they check: includes, attributes, migrations, code libutils already gives.Quand les règles LU sont actives, et ce qu'elles vérifient : includes, attributs, migrations, code que libutils fournit déjà.

The LU-* rules push a C++ project that uses libutils to use it the way it is meant to be used.

Les règles LU-* poussent un projet C++ qui utilise libutils à s'en servir comme prévu.

1. When they are onQuand elles sont actives

ConditionRead from
libutils is installedthe headers in /usr/include, /usr/local/include, ~/.local/include, CPATH, else the MinGW sysroot of mingw64-libutils
the project uses itfind_package(utils) / utils::utils in the root CMakeLists.txt, or utils.hpp included

Both are needed (--libutils auto, the default); --libutils on|off (or XSTYLE_LIBUTILS) forces them. Inside libutils itself they are off. The summary says what was found: libutils v4.3.1 installed, used by the project - libutils rules on.

ConditionLue depuis
libutils est installéeles headers dans /usr/include, /usr/local/include, ~/.local/include, CPATH, sinon le sysroot MinGW de mingw64-libutils
le projet l'utilisefind_package(utils) / utils::utils dans le CMakeLists.txt racine, ou utils.hpp inclus

Il faut les deux (--libutils auto, par défaut) ; --libutils on|off (ou XSTYLE_LIBUTILS) les force. Dans libutils elle-même, elles sont désactivées. Le résumé dit ce qui a été trouvé : libutils v4.3.1 installed, used by the project - libutils rules on.

2. Includes and sectionsIncludes et sections

One root <utils/utils.hpp>, preceded by the #define _Section of every section the file uses, never a libutils header one by one.

#define _Math
#define _Attribute
#include <utils/utils.hpp> // trigo, _nodiscard
RuleIssue
LU-INCLUDEa libutils header included directly
LU-BARE-INCLUDE<utils/utils.hpp> with no #define _Section before it
LU-SECTIONa section used (its utils::<section>:: names, its attribute macros) without its #define

Un seul <utils/utils.hpp> racine, précédé du #define _Section de chaque section utilisée par le fichier, jamais un header de libutils un par un.

#define _Math
#define _Attribute
#include <utils/utils.hpp> // trigo, _nodiscard
RègleProblème
LU-INCLUDEun header de libutils inclus directement
LU-BARE-INCLUDE<utils/utils.hpp> sans aucun #define _Section avant
LU-SECTIONune section utilisée (ses noms utils::<section>::, ses macros d'attributs) sans son #define

3. Attributes and migrationsAttributs et migrations

  • LU-ATTRIBUTE: [[nodiscard]], [[maybe_unused]], alignas(...)... become the libutils macros (_nodiscard, _unused, _alignas...).
  • LU-MIGRATION: a deprecated name becomes the new one, read from the _migration aliases of the installed headers, plus the names libutils v4.0.0 removed (isloaded() → isLoaded(), utils::network::socket::is_ip → utils::network::is_ip, setStyle → set_style, fixed_string → FixedString).

Both are [auto-fix].

  • LU-ATTRIBUTE : [[nodiscard]], [[maybe_unused]], alignas(...)... deviennent les macros de libutils (_nodiscard, _unused, _alignas...).
  • LU-MIGRATION : un nom déprécié devient le nouveau, lu dans les alias _migration des headers installés, plus les noms supprimés par libutils v4.0.0 (isloaded() → isLoaded(), utils::network::socket::is_ip → utils::network::is_ip, setStyle → set_style, fixed_string → FixedString).

Les deux sont [auto-fix].

4. Code libutils already givesCode que libutils fournit déjà

These are [manual]: the hint names the libutils class to use.

RuleWritten by handUse
LU-EXCEPTIONa standard exception thrownutils::exception::ErrorException
LU-ARGSargv parsed by handutils::arguments::ArgParser
LU-ANSIraw ANSI sequencesutils::iomanip
LU-SOCKETBSD socketsutils::network (TCPSocket, Server, Client)
LU-SYSCALLpipe / dup / fork / epoll / shm_open / dlopenutils::encapsulation
LU-THREADSa thread poolutils::pool::Cluster, utils::system::Scheduler
LU-ANGLEdegree / radian conversionsutils::math::trigo
LU-BASE64base64utils::smanip::codec::Base64Codec
LU-VERBOSEa verbose flagutils::verbose
LU-DISTANCEa string distanceutils::algorithms::c2dmp

Ces règles sont [manual] : l'indice donne la classe de libutils à utiliser.

RègleÉcrit à la mainÀ utiliser
LU-EXCEPTIONune exception standard levéeutils::exception::ErrorException
LU-ARGSargv analysé à la mainutils::arguments::ArgParser
LU-ANSIséquences ANSI brutesutils::iomanip
LU-SOCKETsockets BSDutils::network (TCPSocket, Server, Client)
LU-SYSCALLpipe / dup / fork / epoll / shm_open / dlopenutils::encapsulation
LU-THREADSun pool de threadsutils::pool::Cluster, utils::system::Scheduler
LU-ANGLEconversions degrés / radiansutils::math::trigo
LU-BASE64base64utils::smanip::codec::Base64Codec
LU-VERBOSEun flag verboseutils::verbose
LU-DISTANCEune distance entre chaînesutils::algorithms::c2dmp

5. Is the reference up to date?La référence est-elle à jour ?

xstyle --libutils-check compares the installed libutils with the reference of the libutils skill of ai-utils: exit 0 when up to date, 1 when not. The skill is found at $XSTYLE_LIBUTILS_SKILL, else ~/.claude/skills/libutils, else ~/personal_delivery/other/ai-utils/libutils/libutils.

xstyle --libutils-check compare la libutils installée avec la référence du skill libutils de ai-utils : sortie 0 si à jour, 1 sinon. Le skill est cherché dans $XSTYLE_LIBUTILS_SKILL, sinon ~/.claude/skills/libutils, sinon ~/personal_delivery/other/ai-utils/libutils/libutils.