Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pre-commit hook #4520

Merged
merged 1 commit into from
Nov 24, 2021
Merged
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
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']
```