Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
- id: "kube-score"
name: "Run kube-score"
description:
"This hook installs and runs `kube-score` to perform static code analysis of your Kubernetes object definitions"
language: "golang"
types:
- "yaml"
entry: "kube-score score"

- id: "kube-score-system"
name: "Run kube-score from system"
description: >-
This hook runs `kube-score` installed on your system
to perform static code analysis of your Kubernetes object definitions
language: "system"
entry: "kube-score score"
types:
- "yaml"

- id: "kube-score-container"
name: "Run kube-score via container"
description:
"This hook runs `kube-score` via container to perform static code analysis of your Kubernetes object definitions"
language: "docker_image"
types:
- "yaml"
entry: "zegl/kube-score:latest score"
...
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,26 @@ Flags for score:
-v, --verbose count Enable verbose output, can be set multiple times for increased verbosity.
```

### Example with `pre-commit`

`kube-score` can be run as [`pre-commit`](https://pre-commit.com/) hook.
Add the following to your `.pre-commit-config.yaml`:

```yaml
repos:
- repo: "https://github.com/zegl/kube-score"
rev: "<LATEST_VERSION>"
hooks:
- id: "kube-score"
files: "path/to/my/manifests/.*\\.ya?ml"
```

The following hook id's are provided:

- `kube-score`: Installs and runs `kube-score`
- `kube-score-system`: Runs `kube-score` installed on your system
- `kube-score-container`: Runs `kube-score` via container

### Ignoring a test

Tests can be ignored in the whole run of the program, with the `--ignore-test` flag.
Expand Down