check_diff
is a command-line tool targeted to apply static checks on changed
files and lines.
go install github.com/iarkhanhelsky/check_diff@latest
Download the pre-compiled binaries from the releases page and copy them to the desired location.
- Create empty
check_diff.yaml
file in your project root directory. - Specify your linters configuration in
check_diff.yaml
- Change any of your source files introducing lint errors
- Run the following command to check your changes
$ git diff | check_diff
Create simple git hook to check each commit you made:
.git/hook/pre-commit
#!/bin/bash
git diff | bin/check_diff
See Gitlab docs for more information
Example step configuration
check-diff:
stage: test
script:
# Find merge base and make a diff. We don't need changes that appeared in
# upstream after feature branch was created
- git diff -r $(git merge-base $CI_MERGE_REQUEST_DIFF_BASE_SHA HEAD) | ./bin/check_diff --format gitlab -o .gitlab-lint
artifacts:
reports:
codequality: .gitlab-lint
Language | Linter | Bundled Version | Tested With |
---|---|---|---|
Go | golangci-lint | 1.46.0 | -//- |
Java | Checkstyle | 9.3 | -//- |
K8S | kube-linter | 0.2.5 | -//- |
Ruby | rubocop | 1.25.1 | |
Script&Regexp |
- STDOUT - print lint issues in human-readable format
- Phabricator
- Codeclimate