Skip to content

Commit

Permalink
Simplified nix lint apps
Browse files Browse the repository at this point in the history
  • Loading branch information
HU90m committed Aug 31, 2024
1 parent 1d31098 commit 15a78fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -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
Expand Down
38 changes: 8 additions & 30 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
'';
};

Expand All @@ -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."
'';
};

Expand All @@ -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 {
Expand Down

0 comments on commit 15a78fa

Please sign in to comment.