Skip to content

indentation_linter reports "startColumn": 0 -> invalid SARIF file #2550

Description

@pascalgulikers

When using:
lintr::sarif_output(lintr::lint_dir("."), "lintr-results.sarif")

The following is put in the SARIF file:

{
  "ruleId": "indentation_linter",
  "ruleIndex": 12,
  "message": {
    "text": "Indentation should be 2 spaces but is 0 spaces."
  },
  "locations": [
    {
    "physicalLocation": {
      "artifactLocation": {
          "uri": "testfile.R",
          "uriBaseId": "ROOTPATH"
        },
        "region": {
          "startLine": 26,
          "startColumn": 0,
          "snippet": {
          "text": "sometext"
          }
        }
      }
    }
  ]
}

Resulting in the following error in github/codeql-action/upload-sarif@v3

Unable to upload "lintr-results.sarif" as it is not valid SARIF:
instance.runs[0].results[12].locations[0].physicalLocation.region.startColumn must be greater than or equal to 1

Reference: https://docs.oasis-open.org/sarif/sarif/v2.1.0/cs01/sarif-v2.1.0-cs01.pdf

3.30.6 startColumn property
When a region object represents a text region specified by line/column properties, it MAY contain a 
property named startColumn whose value is a positive integer equal to the column number of the first 
character in the region.
If startColumn is absent, it SHALL default to 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions