From 15a78fa09a1d782aae3316b98bbaf7480625aaf9 Mon Sep 17 00:00:00 2001 From: Hugo McNally Date: Sat, 31 Aug 2024 14:14:34 +0100 Subject: [PATCH] Simplified nix lint apps --- .clang-tidy | 2 +- flake.nix | 38 ++++++++------------------------------ 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 43eb5ff..fd38376 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,7 +1,7 @@ Checks: 'clang-diagnostic-*,-clang-diagnostic-error,google-readability-casting,readability-else-after-return,performance-unnecessary-copy-initialization,bugprone-use-after-move,modernize-use-nullptr,modernize-redundant-void-arg,modernize-return-braced-init-list,modernize-use-default-member-init,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nodiscard,modernize-use-override,cppcoreguidelines-avoid-goto,misc-unconventional-assign-operator,cppcoreguidelines-narrowing-conversions,bugprone-assert-side-effect,bugprone-bool-pointer-implicit-conversion,bugprone-copy-constructor-init,bugprone-forwarding-reference-overload,bugprone-macro-parentheses,bugprone-macro-repeated-side-effects,bugprone-move-forwarding-reference,bugprone-misplaced-widening-cast,bugprone-swapped-arguments,bugprone-undelegated-constructor,bugprone-unused-raii,cert-dcl21-cpp,llvm-namespace-comment,misc-static-assert,misc-redundant-expression,modernize-loop-convert,readability-non-const-parameter,readability-identifier-naming' +WarningsAsErrors: '*' FormatStyle: file UseColor: true -WarningsAsErrors: false CheckOptions: - key: readability-identifier-naming.StructCase value: CamelCase diff --git a/flake.nix b/flake.nix index 301f7d8..c9a234a 100644 --- a/flake.nix +++ b/flake.nix @@ -122,19 +122,9 @@ (python3.withPackages (pyPkg: with pyPkg; [mypy pyserial])) ]; text = '' - set +u - case "$1" in - check) - ruff format --check . - ruff check . - mypy . - ;; - fix) - ruff format . - ruff check --fix . - ;; - *) echo "Available subcommands are 'check' and 'fix'.";; - esac + ruff format --check . + ruff check . + mypy . ''; }; @@ -145,22 +135,10 @@ name = "lint-cpp"; runtimeInputs = with lrPkgs; [llvm_cheriot]; text = '' - set +u shopt -s globstar - case "$1" in - check) - clang-format --dry-run --Werror ${srcGlob} - rm -f tidy_fixes - clang-tidy -export-fixes=tidy_fixes -quiet ${srcGlob} - [ ! -f tidy_fixes ] # fail if the fixes file exists - echo "No warnings outside of dependancies." - ;; - fix) - clang-format -i ${srcGlob} - clang-tidy -fix ${srcGlob} - ;; - *) echo "Available subcommands are 'check' and 'fix'.";; - esac + clang-format --dry-run --Werror ${srcGlob} + clang-tidy ${srcGlob} + echo "No warnings outside of dependancies." ''; }; @@ -169,8 +147,8 @@ text = '' ${getExe pkgs.reuse} lint ${getExe pkgs.lychee} --offline --no-progress . - ${getExe lint-python} check - ${getExe lint-cpp} check + ${getExe lint-python} + ${getExe lint-cpp} ''; }; in {