pinterest / arcanist-linters

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

Skip file ignored warning #25

Closed mrcljx closed 4 years ago

mrcljx commented 4 years ago

First of all, thanks for publishing your linters!

I've been into an issue with the eslint linter: My .arclint enables the linter for "include": ["(\\.(j|t)sx?$)"], while excludes are defined in .eslintignore (so that other tools also respect them).

Some version of ESLint (IIRC last year) started emitting a warning so that if one invokes eslint some-ignored-file.js, it communicates to the user that it ignored it.

The warning doesn't have most fields set, so PHP emits a bunch of warnings when building ArcanistLintMessage. This change makes the linter just ignore that warning.

mrcljx commented 4 years ago

This is the error/warning I've been seening:

$ arc lint some-ignored-file.js
[2019-10-18 06:44:10] ERROR 8: Undefined index: ruleId at [/Users/me/Workspace/proj/.arcanist-extensions/pinterest-arcanist-linters/src/ESLintLinter.php:166]
arcanist(head=master, ref.master=3cdfe1fff806), proj(), phutil(head=master, ref.master=3b15fd0a01d4), pinterest-linters()
  #0 ESLintLinter::parseLinterOutput(string, integer, string, string) called at [<arcanist>/src/lint/linter/ArcanistExternalLinter.php:437]
  #1 ArcanistExternalLinter::resolveFuture(string, ExecFuture) called at [<arcanist>/src/lint/linter/ArcanistFutureLinter.php:34]
  #2 ArcanistFutureLinter::didLintPaths(array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:605]
  #3 ArcanistLintEngine::executeDidLintOnPaths(ESLintLinter, array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:556]
  #4 ArcanistLintEngine::executeLintersOnChunk(array, array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:484]
  #5 ArcanistLintEngine::executeLinters(array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:216]
  #6 ArcanistLintEngine::run() called at [<arcanist>/src/workflow/ArcanistLintWorkflow.php:337]
  #7 ArcanistLintWorkflow::run() called at [<arcanist>/scripts/arcanist.php:394]
[2019-10-18 06:44:10] ERROR 8: Undefined index: line at [/Users/me/Workspace/proj/.arcanist-extensions/pinterest-arcanist-linters/src/ESLintLinter.php:168]
arcanist(head=master, ref.master=3cdfe1fff806), proj(), phutil(head=master, ref.master=3b15fd0a01d4), pinterest-linters()
  #0 ESLintLinter::parseLinterOutput(string, integer, string, string) called at [<arcanist>/src/lint/linter/ArcanistExternalLinter.php:437]
  #1 ArcanistExternalLinter::resolveFuture(string, ExecFuture) called at [<arcanist>/src/lint/linter/ArcanistFutureLinter.php:34]
  #2 ArcanistFutureLinter::didLintPaths(array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:605]
  #3 ArcanistLintEngine::executeDidLintOnPaths(ESLintLinter, array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:556]
  #4 ArcanistLintEngine::executeLintersOnChunk(array, array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:484]
  #5 ArcanistLintEngine::executeLinters(array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:216]
  #6 ArcanistLintEngine::run() called at [<arcanist>/src/workflow/ArcanistLintWorkflow.php:337]
  #7 ArcanistLintWorkflow::run() called at [<arcanist>/scripts/arcanist.php:394]
[2019-10-18 06:44:10] ERROR 8: Undefined index: column at [/Users/me/Workspace/proj/.arcanist-extensions/pinterest-arcanist-linters/src/ESLintLinter.php:169]
arcanist(head=master, ref.master=3cdfe1fff806), proj(), phutil(head=master, ref.master=3b15fd0a01d4), pinterest-linters()
  #0 ESLintLinter::parseLinterOutput(string, integer, string, string) called at [<arcanist>/src/lint/linter/ArcanistExternalLinter.php:437]
  #1 ArcanistExternalLinter::resolveFuture(string, ExecFuture) called at [<arcanist>/src/lint/linter/ArcanistFutureLinter.php:34]
  #2 ArcanistFutureLinter::didLintPaths(array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:605]
  #3 ArcanistLintEngine::executeDidLintOnPaths(ESLintLinter, array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:556]
  #4 ArcanistLintEngine::executeLintersOnChunk(array, array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:484]
  #5 ArcanistLintEngine::executeLinters(array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:216]
  #6 ArcanistLintEngine::run() called at [<arcanist>/src/workflow/ArcanistLintWorkflow.php:337]
  #7 ArcanistLintWorkflow::run() called at [<arcanist>/scripts/arcanist.php:394]
>>> Lint for some-ignored-file.js:

   Warning  (/Users/me/Workspace/proj/some-ignored-file.js) 1
    File ignored because of a matching ignore pattern. Use "--no-ignore" to
    override.
jparise commented 4 years ago

Thanks, @sirlantis! This looks very much related to #24.