Hi!
I just found your tool and want to use it to covert a SARIF file produced by typos to CodeClimate (for Gitlab).
The sarif file produced by typos --format sarif > /tmp/sarif.json is as follows:
{
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0.json",
"runs": [
{
"columnKind": "unicodeCodePoints",
"results": [
{
"fixes": [
{
"artifactChanges": [
{
"artifactLocation": {
"uri": "./packet/src/framing.rs"
},
"replacements": [
{
"deletedRegion": {
"endColumn": 30,
"endLine": 268,
"startColumn": 23,
"startLine": 268
},
"insertedContent": {
"text": "writer"
}
},
{
"deletedRegion": {
"endColumn": 30,
"endLine": 268,
"startColumn": 23,
"startLine": 268
},
"insertedContent": {
"text": "written"
}
}
]
}
],
"description": {
"markdown": "`writter` should be `writer`, `written`"
}
}
],
"level": "error",
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "./packet/src/framing.rs"
},
"region": {
"endColumn": 30,
"endLine": 268,
"startColumn": 23,
"startLine": 268
}
}
}
],
"message": {
"markdown": "`writter` should be `writer`, `written`"
}
}
],
"tool": {
"driver": {
"informationUri": "https://github.com/crate-ci/typos",
"name": "typos"
}
}
}
],
"version": "2.1.0"
}
With the following command: pipx run sarif-tools codeclimate /tmp/sarif.json --output /tmp/x.json I get the following error:
NOTE: running app 'sarif' from 'sarif-tools'
Traceback (most recent call last):
File "/home/wiktor/.cache/pipx/5c5a72a6ae11f66/bin/sarif", line 7, in <module>
sys.exit(main())
~~~~^^
File "/home/wiktor/.cache/pipx/5c5a72a6ae11f66/lib/python3.14/site-packages/sarif/cmdline/main.py", line 61, in main
exitcode = args.func(args)
File "/home/wiktor/.cache/pipx/5c5a72a6ae11f66/lib/python3.14/site-packages/sarif/cmdline/main.py", line 317, in _codeclimate_command
_init_path_prefix_stripping(input_files, args, strip_by_default=False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/wiktor/.cache/pipx/5c5a72a6ae11f66/lib/python3.14/site-packages/sarif/cmdline/main.py", line 254, in _init_path_prefix_stripping
input_files.init_path_prefix_stripping(autotrim, trim_paths)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/home/wiktor/.cache/pipx/5c5a72a6ae11f66/lib/python3.14/site-packages/sarif/sarif_file.py", line 593, in init_path_prefix_stripping
input_file.init_path_prefix_stripping(autotrim, path_prefixes)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/wiktor/.cache/pipx/5c5a72a6ae11f66/lib/python3.14/site-packages/sarif/sarif_file.py", line 392, in init_path_prefix_stripping
run.init_path_prefix_stripping(autotrim, path_prefixes)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/wiktor/.cache/pipx/5c5a72a6ae11f66/lib/python3.14/site-packages/sarif/sarif_file.py", line 129, in init_path_prefix_stripping
records = self.get_records()
File "/home/wiktor/.cache/pipx/5c5a72a6ae11f66/lib/python3.14/site-packages/sarif/sarif_file.py", line 226, in get_records
self.result_to_record(result, include_blame_info) for result in results
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/wiktor/.cache/pipx/5c5a72a6ae11f66/lib/python3.14/site-packages/sarif/sarif_file.py", line 245, in result_to_record
error_id = result["ruleId"]
~~~~~~^^^^^^^^^^
KeyError: 'ruleId'
I'm not exactly sure if that's the input file that's broken or if that's an issue with the sarif tools.
pipx run sarif-tools version prints 3.0.5
Thank you for your help! 👋
Hi!
I just found your tool and want to use it to covert a SARIF file produced by
typosto CodeClimate (for Gitlab).The sarif file produced by
typos --format sarif > /tmp/sarif.jsonis as follows:{ "$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0.json", "runs": [ { "columnKind": "unicodeCodePoints", "results": [ { "fixes": [ { "artifactChanges": [ { "artifactLocation": { "uri": "./packet/src/framing.rs" }, "replacements": [ { "deletedRegion": { "endColumn": 30, "endLine": 268, "startColumn": 23, "startLine": 268 }, "insertedContent": { "text": "writer" } }, { "deletedRegion": { "endColumn": 30, "endLine": 268, "startColumn": 23, "startLine": 268 }, "insertedContent": { "text": "written" } } ] } ], "description": { "markdown": "`writter` should be `writer`, `written`" } } ], "level": "error", "locations": [ { "physicalLocation": { "artifactLocation": { "uri": "./packet/src/framing.rs" }, "region": { "endColumn": 30, "endLine": 268, "startColumn": 23, "startLine": 268 } } } ], "message": { "markdown": "`writter` should be `writer`, `written`" } } ], "tool": { "driver": { "informationUri": "https://github.com/crate-ci/typos", "name": "typos" } } } ], "version": "2.1.0" }With the following command:
pipx run sarif-tools codeclimate /tmp/sarif.json --output /tmp/x.jsonI get the following error:I'm not exactly sure if that's the input file that's broken or if that's an issue with the sarif tools.
pipx run sarif-tools versionprints3.0.5Thank you for your help! 👋