-
Notifications
You must be signed in to change notification settings - Fork 10
/
pre-commit-hooks.nix
100 lines (93 loc) · 2.48 KB
/
pre-commit-hooks.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{ pkgs, ... }:
{
# Default hooks
trailing-whitespace-fixer = {
enable = true;
name = "trailing-whitespace";
description = "Remove trailing whitespace";
entry = "${pkgs.python311Packages.pre-commit-hooks}/bin/trailing-whitespace-fixer";
excludes = [ "^patches/" ];
types = [ "text" ];
};
end-of-file-fixer = {
enable = true;
name = "end-of-file-fixer";
description = "Remove trailing whitespace";
entry = "${pkgs.python311Packages.pre-commit-hooks}/bin/end-of-file-fixer";
excludes = [ "^patches/" "png" ];
types = [ "text" ];
};
fix-byte-order-marker = {
enable = true;
name = "fix-byte-order-marker";
entry = "${pkgs.python311Packages.pre-commit-hooks}/bin/fix-byte-order-marker";
types = [ "text" ];
};
mixed-line-ending = {
enable = true;
name = "mixed-line-ending";
entry = "${pkgs.python311Packages.pre-commit-hooks}/bin/mixed-line-ending";
excludes = [ "png" ];
types = [ "text" ];
};
check-case-conflict = {
enable = true;
name = "check-case-conflict";
entry = "${pkgs.python311Packages.pre-commit-hooks}/bin/check-case-conflict";
types = [ "text" ];
};
detect-private-key = {
enable = true;
name = "detect-private-key";
entry = "${pkgs.python311Packages.pre-commit-hooks}/bin/detect-private-key";
types = [ "text" ];
};
# Starlark
bazel-buildifier-format = {
enable = true;
name = "buildifier format";
description = "Format Starlark";
entry = "${pkgs.bazel-buildtools}/bin/buildifier -lint=fix";
types = [ "bazel" ];
};
bazel-buildifier-lint = {
enable = true;
name = "buildifier lint";
description = "Lint Starlark";
entry = "${pkgs.bazel-buildtools}/bin/buildifier -lint=warn";
types = [ "bazel" ];
};
# YAML
yamllint = {
enable = true;
excludes = [ "^.github/styles/" ];
};
# Bash/Shell
shellcheck = {
enable = true;
excludes = [ "png" ];
types_or = [ "shell" ];
};
# Nix
nixpkgs-fmt.enable = true;
# C++
clang-format16 = {
enable = true;
name = "clang-format";
types_or = [ "c" "c++" ];
entry = "${pkgs.llvmPackages_16.libclang}/bin/clang-format";
excludes = [ "^(docs/|^llvm-project-overlay/)" ];
};
# Markdown
markdownlint = {
enable = true;
excludes = [ "^(docs/reference/|docs/rules/|.github/styles/)" ];
types = [ "markdown" ];
};
# Vale
vale = {
enable = true;
excludes = [ "^.github/styles/" ];
types = [ "markdown" ];
};
}