CI integrations
Run check on every pull request and every commit, and read the result as JSON.
check exits 1 when a file breaks a rule and 0 when every file passes. --changed limits it to files git sees as changed,. The examples below build the CLI from the repository, because Lynter is not on a package registry yet.
GitHub Actions
name: lynter
on: [pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}
- run: cargo install --git https://github.com/klappe-pm/lynter.git lynter-cli
- run: lynter check .
GitLab CI
lynter:
image: rust:1
script:
- cargo install --git https://github.com/klappe-pm/lynter.git lynter-cli
- lynter check .
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
pre-commit
repos:
- repo: local
hooks:
- id: lynter
name: lynter
entry: lynter check --changed
language: system
pass_filenames: false
lefthook
pre-commit:
commands:
lynter:
run: lynter check --changed
husky
# .husky/pre-commit
lynter check --changed
JSON output
Add --json to print the result as JSON for a script or a CI annotation step.
lynter check --json > lynter-report.json