Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint formatter returns invalid SARIF in some cases #1791

Closed
michaelcfanning opened this issue Feb 24, 2020 · 0 comments
Closed

ESLint formatter returns invalid SARIF in some cases #1791

michaelcfanning opened this issue Feb 24, 2020 · 0 comments
Labels
area-eslint Issues related to the ESLint SARIF formatter. bug resolved-fixed

Comments

@michaelcfanning
Copy link
Member

michaelcfanning commented Feb 24, 2020

Specifically, we do not always provide the rule ID, e.g.,

{
  "level": "error",
  "message": {
    "text": "Parsing error: ImportDeclaration should appear when the mode is ES6 and in the module context."
  },
  "locations": [
    {
      "physicalLocation": {
        "artifactLocation": {
          "uri": "file:///C:/Dev/SecureApp/SecureApp/ts/node_modules/esrecurse/gulpfile.babel.js",
          "index": 905
        }
      }
    }
  ]
},
ghost pushed a commit that referenced this issue Feb 28, 2020
At times, ESLint emits a message with no `ruleId`, indicating an internal
error in ESLint. Represent this in SARIF as a `toolExecutionNotification`
with `level: "error"`, rather than as a `result` with no `ruleId`, which is
invalid.

This affects some unit tests, which now must always provide a `ruleId`.

Also:
- Per the spec, emit `run.results` even if the array is empty, as a
    positive indicator that the tool found no results. This affects the
    unit test which previously expected `run.results` to be `undefined`
    in this case.
@ghost ghost closed this as completed in cff2c70 Mar 6, 2020
@ghost ghost self-assigned this Mar 6, 2020
@ghost ghost added area-eslint Issues related to the ESLint SARIF formatter. bug resolved-fixed labels Mar 6, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-eslint Issues related to the ESLint SARIF formatter. bug resolved-fixed
Projects
None yet
Development

No branches or pull requests

1 participant