Repository navigation
Commit 7103836
committed
feat(analyze): add SARIF, GitHub and GitLab output formats
`robotcode analyze code` gains a local `--output-format` flag (overrides
the global `--format` for this command) with these values:
- `concise` (default): the human-readable text output
- `json` / `json-indent`: structured result (diagnostics + summary)
- `sarif`: SARIF 2.1.0 log for GitHub code scanning and other consumers
- `github`: GitHub Actions workflow annotations (`::error file=...`)
- `gitlab`: GitLab Code Quality report (JSON array)
`--output-file FILE` writes the report to a file instead of stdout (for
the json/json-indent/sarif/github/gitlab formats), which is handy for CI
artifact upload. A missing target directory raises a clear UsageError and
other I/O errors surface as a ClickException instead of a traceback.
Mapping details shared across the machine formats:
- LSP 0-based ranges become the 1-based positions SARIF/GitHub expect
- severities collapse onto each format's levels (e.g. SARIF error/warning/
note, GitHub error/warning/notice, GitLab major/minor/info)
- artifact paths are POSIX and relative to the project root (what the CI
integrations expect); `--full-paths` switches to absolute paths
- SARIF and GitLab results carry a stable fingerprint (independent of line
number) so alerts survive unrelated edits
- GitHub property/message values are escaped per the @actions/toolkit rules1 parent fc76cf3 commit 7103836
4 files changed
Lines changed: 776 additions & 15 deletions
File tree
- packages/analyze/src/robotcode/analyze/code
- tests/robotcode/analyze/code
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
0 commit comments