Skip to content

Commit

Permalink
feat(ci): add pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
paulopontesm authored Nov 24, 2021
1 parent 7a830b6 commit b13a044
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---

# For use with pre-commit.
# See usage instructions at http://pre-commit.com

- id: kics
name: Checkmarx Kics
description: This hook runs kics.
entry: kics scan -p .
language: golang
pass_filenames: false
always_run: false
types_or:
- terraform
- dockerfile
- yaml
- json
exclude: '^.*\.terraform.*$'
require_serial: true
24 changes: 24 additions & 0 deletions docs/integrations_pre_commit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Running Kics with pre-commmit

To use `kics` with [pre-commit](https://pre-commit.com) add the following hook to your local repo's `.pre-commit-config.yaml` file.

```yaml
- repo: https://github.com/Checkmarx/kics
rev: '' # change to correct tag or sha
hooks:
- id: kics
```
## How to pass extra arguments
You can provide arguments to `kics` by providing the pre-commit `args` [property](https://pre-commit.com/#passing-arguments-to-hooks). The following example will print the `kics scan` output, but will not block regardless of success/failure.

```yaml
repos:
- repo: https://github.com/Checkmarx/kics
rev: '' # change to correct tag or sha
hooks:
- id: kics
verbose: true
args: [--ignore-on-exit, 'all']
```

0 comments on commit b13a044

Please sign in to comment.