Convert your SARIF output into a readable JSON compatible with GitLab Code Climate Tool
npm install sarif-codeclimate
This project aims to convert a SARIF output file from a linter to a CodeClimate output file.
It could be use inside GitLab to display to the user the result of the linter inside the MR.
It was first created to be used in the mega_linter job hosted on r2devops.io.
``bashnpm
npm i -g sarif-codeclimate@latest
`
You can update latest tag by a specific version tag
You can use this tool in two ways:
`bash`
sarif-codeclimate --input -i
👉 You can also use the short version of the arguments and -o.
Output file is optional, if you don't specify it, the output will be printed in the console.
Here is an example of how to read a SARIF file and convert it to a CodeClimate file:
`javascript
const { convert } = require('sarif-codeclimate/out/lib/converter');
const fs = require('fs');
const {
parseResult: {
data,
}
} = convert("megalinter-report.sarif");
fs.writeFileSync('codeclimate-result.json', JSON.stringify(data, null, 4));
``
Are you missing something or want to contribute? Feel free to open an issue or create a pull request