xstylev1.0.0
User guideGuide utilisateur

Getting startedPremiers pas

Install xstyle from its packages or its sources, then run the first check.Installer xstyle depuis ses paquets ou ses sources, puis lancer la première vérification.

xstyle is one binary, xstyle, with no configuration file: install it, run it in a project.

xstyle est un seul binaire, xstyle, sans fichier de configuration : on l'installe, on le lance dans un projet.

1. Install from the packagesInstaller depuis les paquets

The packages are RPM (Fedora), DEB (Debian / Ubuntu) and Arch (pacman), signed with the key RPM-GPG-KEY-tsukini. Every package repository of TsukiNi22 at once, with my-universe:

curl -fsSL https://tsukini22.github.io/my-universe/install.sh | bash -s
sudo dnf install xstyle          # or: sudo apt install xstyle / sudo pacman -S xstyle

Or only the repository of xstyle, with its setup.sh (no clone needed):

curl -fsSL https://raw.githubusercontent.com/TsukiNi22/xstyle/main/setup.sh | bash -s -- --install
Argument of setup.shEffect
--installAlso install the package (by default only the repository and the GPG key are set up)
--preThe pre-release package (xstyle-pre)
--no-sudoRun without sudo (already root)

An invalid hash error of dnf / apt is fixed by cleaning the cache of the tool, or by running setup.sh again.

Les paquets existent en RPM (Fedora), DEB (Debian / Ubuntu) et Arch (pacman), signés avec la clé RPM-GPG-KEY-tsukini. Tous les dépôts de paquets de TsukiNi22 d'un coup, avec my-universe :

curl -fsSL https://tsukini22.github.io/my-universe/install.sh | bash -s
sudo dnf install xstyle          # ou : sudo apt install xstyle / sudo pacman -S xstyle

Ou seulement le dépôt de xstyle, avec son setup.sh (sans clone) :

curl -fsSL https://raw.githubusercontent.com/TsukiNi22/xstyle/main/setup.sh | bash -s -- --install
Argument de setup.shEffet
--installInstalle aussi le paquet (par défaut seuls le dépôt et la clé GPG sont configurés)
--preLe paquet de pré-release (xstyle-pre)
--no-sudoLancer sans sudo (déjà root)

Une erreur invalid hash de dnf / apt se règle en vidant le cache de l'outil, ou en relançant setup.sh.

2. Build from the sourcesCompiler depuis les sources

Needs clang++ (C++20), cmake >= 3.20 and libutils >= 4.1.0 (>= 4.2.0 on Arch).

git clone https://github.com/TsukiNi22/xstyle.git && cd xstyle
cmake -S . -B build -DCMAKE_BUILD_TYPE=Optimized
cmake --build build --parallel $(nproc)                       # ./xstyle at the root
sudo cmake --build build --target install --parallel $(nproc) # /usr/local/bin/xstyle + the completions
cmake --install build --prefix ~/.local                       # or without root: ~/.local/bin/xstyle

Il faut clang++ (C++20), cmake >= 3.20 et libutils >= 4.1.0 (>= 4.2.0 sur Arch).

git clone https://github.com/TsukiNi22/xstyle.git && cd xstyle
cmake -S . -B build -DCMAKE_BUILD_TYPE=Optimized
cmake --build build --parallel $(nproc)                       # ./xstyle à la racine
sudo cmake --build build --target install --parallel $(nproc) # /usr/local/bin/xstyle + les complétions
cmake --install build --prefix ~/.local                       # ou sans root : ~/.local/bin/xstyle

3. First checkPremière vérification

  1. Go to a project: cd my-project.
  2. Run xstyle: every known file of the current directory is checked, recursively.
  3. Read the summary at the end: the counters by severity and by rule.
  4. Fix what is safe: xstyle --fix, then review it with git diff.
xstyle            # check everything
xstyle -S         # only the summary
xstyle --fix      # apply the safe fixes

Tip. The first run also shows one mandatory reminder, R34: it is never counted. What it is and how to hide it.

Next: everyday use.

  1. Aller dans un projet : cd mon-projet.
  2. Lancer xstyle : tous les fichiers connus du dossier courant sont vérifiés, récursivement.
  3. Lire le résumé à la fin : les compteurs par sévérité et par règle.
  4. Corriger ce qui est sûr : xstyle --fix, puis relire avec git diff.
xstyle            # tout vérifier
xstyle -S         # seulement le résumé
xstyle --fix      # appliquer les corrections sûres

Astuce. Le premier lancement affiche aussi un rappel obligatoire, R34 : il n'est jamais compté. Ce que c'est et comment le masquer.

Ensuite : l'usage courant.