SonarJS cease to analyse if dot is used in argument of function

  • Versions used - SonarLint plugin for IntelliJ v4.0.2.3009
  • error observed: Analysing 'solace.js'... File won't be refreshed because there were errors during analysis: C:/projects/CopyTrader/Fx.CopyTrader.Web/App/services/solace.js Found 0 issues
  • steps to reproduce: 1. Create proper JS file with function() {} 2. Add argument similar to _connection.interopSession like function(_connection.interopSession) {} which is incorrect syntax
  • potential workaround: check for proper syntax

Hello,

I don’t understand the problem here, you write invalid code - analysis is not done. What would you expect?

There is nothing in list of errors. Just like the code is fine. It took some time to figure out that output should be checked for errors. And then there is nothing about the type of error or line on which analysis got exception. Took some more time to figure out that was wrong (having “Found 0 issues”).

What I did to find out what crashed the analysis is removed all code from file and added methods back by parts to figure out that problem was with dot.

What I expect:

  • There is something in list of errors.
  • Ability to perceive easily code status in such cases
  • Fast time to figure out that output should be checked for errors.
  • Have something about the type of error or line on which analysis got exception.
  • Fast time to figure out that was wrong (don’t display “Found 0 issues” but something relevant).
  • Ability to find out what crashed the analysis

Now I’m using VSCode mostly and VS2017 and Rider sometimes. Want to make your product better because I love it.

Hi @Ivajkin,

Thanks for helping us making our products better :slight_smile:

In the current situation, we are triggering analysis on a regular basis, each time user is doing a change in the editor (with some delay). It means the analysis could easily be triggered in the middle of a typing, where the syntax is invalid. We don’t want to pollute users with a flood of feedback telling them the current code in not valid. That’s why we don’t report parsing errors in a very visible way (you can still find the detail in the SonarLint logs, when activating verbose output).

Also, to avoid the list of issues to “blink”, in case of parsing error, we don’t clear the list, but retain the list of issues detected during the previous successful analysis.

SonarLint is not designed to be a compiler/syntax checker. Usually IDEs do that already. I’m not sure we should move in this direction.

That’s where I think we could improve. We could have an indicator on the SonarLint panel that current file last analysis failed. Maybe gray out the file name, or put an icon next to it (something that wont “blink” too much):
image

I created a ticket to not forget: [SLI-337] - Jira

If you enable verbose logs, you should get all those details already:

2 Likes