misc/pre-commit: add automatic clang-format of changed lines
Lix has a style guide: https://wiki.lix.systems/books/lix-contributors/page/code but contributors like me have been unable to enforce it, which is sad. To avoid further violations of that style guide, we enable a pre-commit hook for clang formatting of the changed lines. Change-Id: I217452efa3ac8bd66b4d3a08a6fe9a241207790b Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
@@ -32,6 +32,21 @@ pre-commit-run {
|
||||
enable = true;
|
||||
settings.branch = [ "main" ];
|
||||
};
|
||||
clang-format = {
|
||||
enable = true;
|
||||
package = pkgs.llvmPackages.libclang.python;
|
||||
entry = "${pkgs.llvmPackages.libclang.python}/bin/git-clang-format";
|
||||
files = "^(lix/|tests/)";
|
||||
types = [
|
||||
"c++"
|
||||
"file"
|
||||
];
|
||||
excludes = [
|
||||
''^lix/pch/.*$''
|
||||
''\.gen\.hh$''
|
||||
];
|
||||
pass_filenames = false; # this will automatically format everything in the stage area of Git.
|
||||
};
|
||||
check-case-conflicts.enable = true;
|
||||
check-executables-have-shebangs = {
|
||||
enable = true;
|
||||
|
||||
Reference in New Issue
Block a user