Skip to content

Commit fdc1ecc

Browse files
committed
chore: use OOTB git hook
1 parent 1d8ea32 commit fdc1ecc

File tree

3 files changed

+31
-55
lines changed

3 files changed

+31
-55
lines changed

devenv.lock

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"devenv": {
44
"locked": {
55
"dir": "src/modules",
6-
"lastModified": 1739172804,
6+
"lastModified": 1741068816,
77
"owner": "cachix",
88
"repo": "devenv",
9-
"rev": "f8be0ed0141abab89cefb20d3d375740671fbee1",
9+
"rev": "9f6da63c162ad86b6fb84edcbd8c447fdc411c3d",
1010
"type": "github"
1111
},
1212
"original": {
@@ -31,10 +31,31 @@
3131
"type": "github"
3232
}
3333
},
34+
"git-hooks": {
35+
"inputs": {
36+
"flake-compat": "flake-compat",
37+
"gitignore": "gitignore",
38+
"nixpkgs": [
39+
"nixpkgs"
40+
]
41+
},
42+
"locked": {
43+
"lastModified": 1740915799,
44+
"owner": "cachix",
45+
"repo": "git-hooks.nix",
46+
"rev": "42b1ba089d2034d910566bf6b40830af6b8ec732",
47+
"type": "github"
48+
},
49+
"original": {
50+
"owner": "cachix",
51+
"repo": "git-hooks.nix",
52+
"type": "github"
53+
}
54+
},
3455
"gitignore": {
3556
"inputs": {
3657
"nixpkgs": [
37-
"pre-commit-hooks",
58+
"git-hooks",
3859
"nixpkgs"
3960
]
4061
},
@@ -66,32 +87,14 @@
6687
"type": "github"
6788
}
6889
},
69-
"pre-commit-hooks": {
70-
"inputs": {
71-
"flake-compat": "flake-compat",
72-
"gitignore": "gitignore",
73-
"nixpkgs": [
74-
"nixpkgs"
75-
]
76-
},
77-
"locked": {
78-
"lastModified": 1737465171,
79-
"owner": "cachix",
80-
"repo": "pre-commit-hooks.nix",
81-
"rev": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17",
82-
"type": "github"
83-
},
84-
"original": {
85-
"owner": "cachix",
86-
"repo": "pre-commit-hooks.nix",
87-
"type": "github"
88-
}
89-
},
9090
"root": {
9191
"inputs": {
9292
"devenv": "devenv",
93+
"git-hooks": "git-hooks",
9394
"nixpkgs": "nixpkgs",
94-
"pre-commit-hooks": "pre-commit-hooks"
95+
"pre-commit-hooks": [
96+
"git-hooks"
97+
]
9598
}
9699
}
97100
},

devenv.nix

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,9 @@
1010
# https://devenv.sh/packages/
1111
packages = [
1212
pkgs.git
13-
pkgs.python312Packages.openapi-spec-validator
1413
];
1514

16-
# https://devenv.sh/tests/
17-
enterTest = ''
18-
openapi-spec-validator spec/*.yaml
19-
'';
20-
2115
scripts.format.exec = ''
22-
yamlfmt .
2316
markdownlint --fix .
2417
pre-commit run --all-files
2518
'';
@@ -29,31 +22,11 @@
2922
typos.enable = true;
3023
yamllint.enable = true;
3124
yamlfmt.enable = true;
25+
yamlfmt.settings.lint-only = false;
3226
commitizen.enable = true;
3327
nixfmt-rfc-style.enable = true;
3428
markdownlint.enable = true;
35-
};
36-
37-
git-hooks.hooks.validate-spec = {
38-
enable = true;
39-
40-
# The name of the hook (appears on the report table):
41-
name = "Validate OpenAPI spec";
42-
43-
# The command to execute (mandatory):
44-
entry = "openapi-spec-validator";
45-
46-
# The pattern of files to run on (default: "" (all))
47-
# see also https://pre-commit.com/#hooks-files
48-
files = "^spec/.*\\.(yaml|yml|json)$";
49-
50-
# The language of the hook - tells pre-commit
51-
# how to install the hook (default: "system")
52-
# see also https://pre-commit.com/#supported-languages
53-
language = "system";
54-
55-
# Set this to false to not pass the changed files
56-
# to the command (default: true):
57-
pass_filenames = true;
29+
mdformat.enable = true;
30+
openapi-spec-validator.enable = true;
5831
};
5932
}
File renamed without changes.

0 commit comments

Comments
 (0)