Add shorthands to justfile for code linting and formatting.

This commit is contained in:
Alejandro Cabeza Romero 2026-06-19 14:51:37 +02:00
parent 799aa40bb6
commit 3bfcc96998
No known key found for this signature in database
GPG Key ID: DA3D14AE478030FD
2 changed files with 50 additions and 2 deletions

28
.clang-format Normal file
View File

@ -0,0 +1,28 @@
BasedOnStyle: LLVM
IndentWidth: 4
ColumnLimit: 120
IndentAccessModifiers: false
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
BinPackParameters: false
BinPackArguments: false
AllowAllParametersOfDeclarationOnNextLine: false
PenaltyBreakBeforeFirstCallParameter: 1
PointerAlignment: Left
ReferenceAlignment: Left
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
BreakAfterReturnType: None
PenaltyReturnTypeOnItsOwnLine: 1000
BreakTemplateDeclarations: Yes
NamespaceIndentation: All

View File

@ -28,8 +28,12 @@ clean *args:
fi
}
if pgrep -x logos > /dev/null; then
confirm "Kill 'logos' process?" && pkill logos
logos_procs="$(pgrep -ax logos_host_qt || true)"
if [ -n "$logos_procs" ]; then
echo "Found matching processes:"
echo "$logos_procs"
echo "This will kill the process(es) above."
confirm "Proceed?" && { pkill -x logos_host_qt; echo "Killed."; }
else
echo "Already killed"
fi
@ -50,3 +54,19 @@ clean *args:
run: (clean "-y")
nix run
# Launch CLion inside the Nix dev shell so it inherits required variables and fully integrates with Nix.
clion:
nix develop -c "$HOME/.local/share/JetBrains/Toolbox/apps/clion/bin/clion.sh" . >/dev/null 2>&1 &
prettify:
nix shell nixpkgs#clang-tools -c clang-format -i src/**.cpp src/**.h
# Reuses cmake-build-debug's compile_commands.json (generated by CLion) instead
# of a `configure` step — this repo has no standalone `build` recipe.
lint:
nix shell nixpkgs#clang-tools --command clang-tidy \
-p cmake-build-debug \
--header-filter='src/.*' \
--extra-arg-before=--driver-mode=g++ \
src/BlockchainPlugin.cpp src/BlockchainBackend.cpp src/AccountsModel.cpp src/LogModel.cpp