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

fix(pre-commit): pre-commit hook fix and integration update #5031

Merged
merged 1 commit into from
Mar 28, 2022
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
34 changes: 19 additions & 15 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
---

# 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
# - 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

- id: kics-scan
name: Checkmarx Kics Scan
language: docker
entry: kics scan -p /src --no-progress
34 changes: 25 additions & 9 deletions docs/integrations_pre_commit.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 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.
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
rev: "" # change to correct tag or sha
hooks:
- id: kics
- id: kics-scan
```

## How to pass extra arguments
Expand All @@ -15,10 +15,26 @@ You can provide arguments to `kics` by providing the pre-commit `args` [property

```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']
- repo: https://github.com/Checkmarx/kics
rev: "" # change to correct tag or sha
hooks:
- id: kics-scan
verbose: true
args: [--ignore-on-exit, "all"]
```

## Create your own local pre-commit hook

You can create your own local pre-commit hook using the [docker_image](https://pre-commit.com/#docker_image) language.
This is a more lightweight way to configure `kics` as a pre-commit hook.

```yaml
repos:
- repo: local
hooks:
- id: kics-scan-local
name: Kics scan
language: docker_image
entry: checkmarx/kics scan -p /src --no-progress
verbose: true
```