checkstyle-to-sarif

April 9, 2026 ยท View on GitHub

npm version npm downloads CI License: MIT

Convert Checkstyle XML output to Static Analysis Results Interchange Format (SARIF) for GitHub Code Scanning.

Usage

File Input

npx checkstyle-to-sarif --input /path/to/checkstyle.xml --output /path/to/results.sarif

stdin

cat /path/to/checkstyle.xml | npx checkstyle-to-sarif --output /path/to/results.sarif

stdout

npx checkstyle-to-sarif --input /path/to/checkstyle.xml > /path/to/results.sarif

Aliases

npx checkstyle-to-sarif -i /path/to/checkstyle.xml -o /path/to/results.sarif

CLI Options

  • --input <path>, -i <path>: path to the Checkstyle XML input file
  • --output <path>, -o <path>: path to write SARIF output (defaults to stdout)
  • --help: show help
  • --version: show version

Node.js Usage

import { convertCheckstyleToSarif } from 'checkstyle-to-sarif'
import { readFile, writeFile } from 'node:fs/promises'

const xml = await readFile('checkstyle.xml', 'utf-8')
const sarif = convertCheckstyleToSarif(xml)
await writeFile('results.sarif', sarif, 'utf-8')

Development

pnpm install
pnpm build
pnpm test

License

MIT