pinterest / arcanist-linters

A collection of custom Arcanist linters
Apache License 2.0
62 stars 45 forks source link

Fixed an Arcanist crash bug caused by ruleId being null #60

Closed tiguchi closed 3 years ago

tiguchi commented 3 years ago

There is an edge case while running ESlint that can cause Arcanist to crash with the following error message:

Linter "ESLintLinter" generated a lint message that is invalid because it does not have a name. Lint messages must have a name.

This edge case can be triggered by trying to lint a source file with a syntax error in it. That produces an ESlint JSON output where ruleId is null.

The idx function however does not fall back to using the provided default value 'unknown'. It does actually the following: if the dictionary property value is null, and if the tested key (here ruleId) exists in the dictionary, then it returns null instead of the fallback default value.

This fix makes sure we never set a null value for the name property.

Testing

jparise commented 3 years ago

Thanks again, @tiguchi!