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 xstyleOr 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 -- --installArgument of setup.sh | Effect |
|---|---|
--install | Also install the package (by default only the repository and the GPG key are set up) |
--pre | The pre-release package (xstyle-pre) |
--no-sudo | Run 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 xstyleOu 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 -- --installArgument de setup.sh | Effet |
|---|---|
--install | Installe aussi le paquet (par défaut seuls le dépôt et la clé GPG sont configurés) |
--pre | Le paquet de pré-release (xstyle-pre) |
--no-sudo | Lancer 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/xstyleIl 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/xstyle3. First checkPremière vérification
- Go to a project:
cd my-project. - Run
xstyle: every known file of the current directory is checked, recursively. - Read the summary at the end: the counters by severity and by rule.
- Fix what is safe:
xstyle --fix, then review it withgit diff.
xstyle # check everything
xstyle -S # only the summary
xstyle --fix # apply the safe fixesTip. The first run also shows one mandatory reminder, R34: it is never counted. What it is and how to hide it.
Next: everyday use.
- Aller dans un projet :
cd mon-projet. - Lancer
xstyle: tous les fichiers connus du dossier courant sont vérifiés, récursivement. - Lire le résumé à la fin : les compteurs par sévérité et par règle.
- Corriger ce qui est sûr :
xstyle --fix, puis relire avecgit diff.
xstyle # tout vérifier
xstyle -S # seulement le résumé
xstyle --fix # appliquer les corrections sûresAstuce. 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.