check_diff (wip)
check_diff
is a command-line tool targeted to apply static checks on changed
files and lines.
Install
go install
go install github.com/iarkhanhelsky/check_diff@latest
manually
Download the pre-compiled binaries from the releases
page and copy them to the desired location.
Setup
Local
- 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
git hooks
Create simple git hook to check each commit you made:
.git/hook/pre-commit
#!/bin/bash
git diff | bin/check_diff
CI
Gitlab
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
Builtin linter bindings
- STDOUT - print lint issues in human-readable format
- Phabricator
- Codeclimate