gilbarbara / codeclimate-stylelint

A Code Climate engine for the mighty, modern CSS linter
24 stars 18 forks source link

When running `codeclimate analyze` on other files codeclimate-stylelint causes it to fail. #8

Closed leonelgalan closed 7 years ago

leonelgalan commented 7 years ago

When running codeclimate analyze example.rb the analysis fails because of

https://github.com/gilbarbara/codeclimate-stylelint/blob/master/bin/codeclimate-stylelint#L128:

    if (!analysisFiles.length) {
      console.error(`No files to lint with the extensions: "${options.extensions.join('", "')}".`);
      console.error('See our documentation at https://docs.codeclimate.com/docs/stylelint for more information.');
      process.exit(1);
    }

Expected behavior is that codeclimate-stylelint simply doesn't run against that file because, but let other engines run.

Current behavior is

Running rubocop: Done!
error: (CC::Analyzer::Engine::EngineFailure) engine stylelint:stable failed with status 1 and stderr
No files to lint with the extensions: ".css", ".scss", ".less", ".sss".
See our documentation at https://docs.codeclimate.com/docs/stylelint for more information.

This prevents me from seeing the result thrown by other engine(s).

leonelgalan commented 7 years ago

I've clone and build the engine locally. Commenting this process.exit(1); is not enough, the other process. exit(1) in the catch is triggered and it shows:

Error: undefined does not match any files
See our documentation at https://docs.codeclimate.com/docs/stylelint for more information.

Ultimately analysisFiles, shouldn't be undefined, but an empty array if no file matches.