Boeing / config-file-validator

Cross Platform tool to validate configuration files
https://boeing.github.io/config-file-validator/
Apache License 2.0
324 stars 55 forks source link

Add SARIF as a reporter option #166

Open shiina4119 opened 1 month ago

shiina4119 commented 1 month ago

Fixes #32

shiina4119 commented 1 month ago

Testing locally on my machine, this is the SARIF report that's generated. Please LMK if this is fine.

Also please tell me if I need to add more tests.

Lastly I am new to Go, so please forgive me if there are any obvious mistakes.

{
  "version": "2.1.0",
  "$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.4.json",
  "runs": [
    {
      "tool": {
        "driver": {
          "name": "config-file-validator",
          "informationUri": "https://github.com/Boeing/config-file-validator/issues/32"
        }
      },
      "artifacts": [
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.csv"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.editorconfig"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.env"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.hcl"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.hocon"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.ini"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.json"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.plist"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.properties"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.toml"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/bad.yml"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.csv"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.editorconfig"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.env"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.hcl"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.hocon"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.ini"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.json"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.plist"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.properties"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.toml"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/good.yaml"
          }
        },
        {
          "location": {
            "uri": "/home/shiina/projects/cfv-test/result.xml"
          }
        }
      ],
      "results": [
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "parse error on line 1, column 20: bare \" in non-quoted-field"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.csv",
                  "index": 0
                }
              }
            }
          ]
        },
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "cannot load ini file: unclosed section: [*.md\n"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.editorconfig",
                  "index": 1
                }
              }
            }
          ]
        },
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "Error at line 2: invalid escape sequence: \"a\""
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.env",
                  "index": 2
                }
              }
            }
          ]
        },
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "error at line 1 column 1: :1,1-2: Invalid argument name; Argument names must not be quoted."
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.hcl",
                  "index": 3
                }
              }
            }
          ]
        },
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "two adjacent commas at: 3:16, adjacent commas in arrays and objects are invalid!"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.hocon",
                  "index": 4
                }
              }
            }
          ]
        },
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "key-value delimiter not found: name value\n"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.ini",
                  "index": 5
                }
              }
            }
          ]
        },
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "Error at line 3 column 14: invalid character ':' after array element"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.json",
                  "index": 6
                }
              }
            }
          ]
        },
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "plist: error parsing XML property list: missing value in dictionary"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.plist",
                  "index": 7
                }
              }
            }
          ]
        },
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "circular reference in:\nkey=${key}\n"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.properties",
                  "index": 8
                }
              }
            }
          ]
        },
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "Error at line 6 column 6: toml: expected character ="
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.toml",
                  "index": 9
                }
              }
            }
          ]
        },
        {
          "kind": "fail",
          "level": "error",
          "message": {
            "text": "yaml: line 3: did not find expected '-' indicator"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/bad.yml",
                  "index": 10
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.csv",
                  "index": 11
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.editorconfig",
                  "index": 12
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.env",
                  "index": 13
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.hcl",
                  "index": 14
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.hocon",
                  "index": 15
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.ini",
                  "index": 16
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.json",
                  "index": 17
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.plist",
                  "index": 18
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.properties",
                  "index": 19
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.toml",
                  "index": 20
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/good.yaml",
                  "index": 21
                }
              }
            }
          ]
        },
        {
          "kind": "pass",
          "level": "none",
          "message": {
            "text": "No errors detected"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "/home/shiina/projects/cfv-test/result.xml",
                  "index": 22
                }
              }
            }
          ]
        }
      ]
    }
  ]
}