Wymuszanie w CI¶
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'
Hook pre-commit¶
Add to .pre-commit-config.yaml:
- repo: https://github.com/TurtleTech-ehf/snapper
rev: v0.3.1
hooks:
- id: snapper
Uruchamia snapper --in-place na zmienionych plikach pasujących do .org, .tex, .md i .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
Podgląd zmian w CI¶
Użyj --diff, aby wyświetlić planowane zmiany:
- 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
Integracja z Makefile¶
.PHONY: fmt fmt-check
fmt:
snapper --in-place paper.org sections/*.org
fmt-check:
snapper --check paper.org sections/*.org