CI-framfylgd¶
GitHub Action (recommended)¶
The easiest way to enforce semantic line breaks in CI. Add to your workflow:
- uses: TurtleTech-ehf/snapper@v0.3.1
with:
files: '**/*.org **/*.tex **/*.md'
This installs snapper and runs --check on the specified files.
For GitHub Code Scanning integration (SARIF annotations on PRs):
- uses: TurtleTech-ehf/snapper@v0.3.1
with:
files: '**/*.org **/*.tex **/*.md'
sarif: 'true'
Pre-commit hook¶
Add to .pre-commit-config.yaml:
- repo: https://github.com/TurtleTech-ehf/snapper
rev: v0.3.1
hooks:
- id: snapper
Þetta keyrir snapper --in-place á breyttum skrám sem passa við .org, .tex, .md og .txt.
Manual GitHub Actions¶
If you prefer manual setup over the composite action:
- name: Install snapper
run: cargo binstall -y snapper-fmt
- name: Check formatting
run: snapper --check paper.org sections/*.org
For structured output:
- name: Check with SARIF
run: snapper --check --output-format sarif **/*.org > snapper.sarif || true
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: snapper.sarif
Forskoða breytingar í CI¶
Notaðu --diff til að sýna hvað myndi breytast:
- name: Show formatting diff
run: snapper --diff paper.org sections/*.org
GitLab CI¶
format-check:
image: rust:latest
script:
- cargo binstall -y snapper-fmt
- snapper --check **/*.org **/*.tex **/*.md
allow_failure: false
Makefile samþætting¶
.PHONY: fmt fmt-check
fmt:
snapper --in-place paper.org sections/*.org
fmt-check:
snapper --check paper.org sections/*.org