Skip to content

Commit c340ea9

Browse files
authored
fix: pre-commit-hooks (stackrox#475)
Fix pre-commit-hooks to work with canonical pre-commit Also change the documentation to reflect the changes
1 parent 333f145 commit c340ea9

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

.pre-commit-hooks.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
- id: kube-linter
22
name: KubeLinter
33
description: This hook installs (using Go) and runs the KubeLinter utility to lint Helm charts and Kubernetes YAML files.
4-
entry: kube-linter
4+
entry: kube-linter lint
55
language: golang
66
types: [yaml]
77

88
- id: kube-linter-system
99
name: KubeLinter System
1010
description: This hook runs the KubeLinter utility that exists already on the system to lint Helm charts and Kubernetes YAML files.
11-
entry: kube-linter
11+
entry: kube-linter lint
1212
language: system
1313
types: [yaml]
1414

@@ -17,4 +17,4 @@
1717
description: This hook runs kube-linter using the project's official docker image
1818
language: docker_image
1919
types: [yaml]
20-
entry: stackrox/kube-linter:0.2.6
20+
entry: stackrox/kube-linter:0.2.6 lint

docs/using-kubelinter.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,15 @@ kube-linter lint /path/to/directory/containing/Chart.yaml-file/
3737

3838
If you are using the [pre-commit framework](https://pre-commit.com/) for
3939
managing Git pre-commit hooks, you can install and use KubeLinter as a
40-
pre-commit hook. To do this:
41-
42-
1. Download the [`.pre-commit-hooks.yaml`](https://raw.githubusercontent.com/stackrox/kube-linter/main/.pre-commit-hooks.yaml)
43-
file in the Git repository in which you want to install the KubeLinter
44-
pre-commit hooks:
45-
```bash
46-
curl -O https://raw.githubusercontent.com/stackrox/kube-linter/main/.pre-commit-hooks.yaml
47-
```
48-
1. Run the `pre-commit install` command:
49-
```bash
50-
pre-commit install
51-
```
52-
1. After installation, the KubeLinter pre-commit hooks run whenever you run the
53-
`git commit` command.
40+
pre-commit hook. To do this, add the following to your `.pre-commit-config.yaml`:
41+
42+
```yaml
43+
- repo: https://github.com/stackrox/kube-linter
44+
rev: 0.6.0 # kube-linter version
45+
hooks:
46+
# You can change this to kube-linter-system or kube-linter-docker
47+
- id: kube-linter
48+
```
5449
5550
The [`.pre-commit-hooks.yaml`](https://raw.githubusercontent.com/stackrox/kube-linter/main/.pre-commit-hooks.yaml)
5651
includes the following pre-commit hooks:

0 commit comments

Comments
 (0)