aboutsummaryrefslogtreecommitdiff
path: root/maintainers/check-headers.nix
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-04-08 15:08:29 -0700
committerJade Lovelace <lix@jade.fyi>2024-04-08 16:10:57 -0700
commit1e74bffd5c37bed52ef8547ffa2b4e7f895e4e2a (patch)
tree7f228848a272e2883cf97705eae96f83200ef4b8 /maintainers/check-headers.nix
parentc58e3f826e891847bd454f4de8176e1fec74627a (diff)
pre-commit check for pragma once and ///@file
This is in our style guide, we can cheaply enforce it, let's do it. ``` $ pre-commit check-case-conflicts.....................................................Passed check-executables-have-shebangs..........................................Passed check-headers............................................................Failed - hook id: check-headers - exit code: 1 Missing pattern @file in file src/libexpr/value.hh We found some header files that don't conform to the style guide. The Lix style guide requests that header files: - Begin with `#pragma once` so they only get parsed once - Contain a doxygen comment (`/**` or `///`) containing `@file`, for example, `///@file`, which will make doxygen generate docs for them. When adding that, consider also adding a `@brief` with a sentence explaining what the header is for. For more details: https://wiki.lix.systems/link/3#bkmrk-header-files check-merge-conflicts....................................................Passed check-shebang-scripts-are-executable.....................................Passed check-symlinks.......................................(no files to check)Skipped end-of-file-fixer........................................................Passed mixed-line-endings.......................................................Passed no-commit-to-branch......................................................Passed release-notes........................................(no files to check)Skipped treefmt..................................................................Passed trim-trailing-whitespace.................................................Passed ``` Fixes: https://git.lix.systems/lix-project/lix/issues/233 Change-Id: I77150b9298c844ffedd0f85cc5250ae9208502e3
Diffstat (limited to 'maintainers/check-headers.nix')
-rw-r--r--maintainers/check-headers.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/maintainers/check-headers.nix b/maintainers/check-headers.nix
new file mode 100644
index 000000000..a184bb401
--- /dev/null
+++ b/maintainers/check-headers.nix
@@ -0,0 +1,7 @@
+{ writeShellApplication, gnugrep }:
+writeShellApplication {
+ name = "check-headers";
+
+ runtimeInputs = [ gnugrep ];
+ text = builtins.readFile ./check-headers.sh;
+}