Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ spinlint validate 'pipelines/**/*.json' overrides/hotfix.json

| Flag | Short | Default | Description |
|---|---|---|---|
| `--format` | `-f` | `text` | Output format: `text` or `json` |
| `--format` | `-f` | `text` | Output format: `text`, `json`, or `sarif` |

---

Expand Down Expand Up @@ -139,6 +139,30 @@ spinlint validate --format json 'pipelines/*.json' \
| jq -r '.[] | select(.violations | length > 0) | .file'
```

### sarif

Emits a [SARIF 2.1.0](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html) document. Upload it to [GitHub Code Scanning](https://docs.github.com/en/code-security/code-scanning) to surface violations as inline annotations directly on PR diffs — no log diving required.

```bash
spinlint validate --format sarif 'pipelines/*.json' > results.sarif
```

**GitHub Actions — upload to Code Scanning:**

```yaml
- name: Run spinlint (SARIF)
run: ./bin/spinlint validate --format sarif 'pipelines/*.json' > results.sarif || true

- name: Upload SARIF to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
```

> The `|| true` prevents a non-zero exit from blocking the upload step. The job must have `permissions: security-events: write`.

Each violation maps to a SARIF `result` with `ruleId`, `level: "error"`, the violation message, and a `physicalLocation` URI relative to the repository root.

---

## Rules
Expand Down Expand Up @@ -328,7 +352,7 @@ type Stage struct {
}
```

The rule will automatically be included in both `text` and `json` output with no further changes.
The rule will automatically be included in `text`, `json`, and `sarif` output with no further changes.

---

Expand Down
Loading