"Automatically trigger analysis" in IntelliJ triggers auto-save

547 views
Skip to first unread message

alix....@gmail.com

unread,
Aug 17, 2017, 9:58:24 AM8/17/17
to SonarLint
In a web project using webpack it is convenient to make some changes and then manually trigger a recompilation. This works as expected in IntelliJ unless checking the checkbox "Automatically trigger analysis" for SonarLint.
When this checkbox is enabled, every time you are done with a line of code and press Enter it will auto-save and trigger webpack to rebuild the project.

I think that SonarLint should respect the settings in IntelliJ regarding when to save and only then trigger an analysis, instead of force-saving to be able to analyze. Any thoughts on this?

SonarLint version: 3.0.0.2041

Duarte Meneses

unread,
Aug 17, 2017, 10:03:27 AM8/17/17
to alix....@gmail.com, SonarLint
Hi,

Old code analyzers read the source files from disk, so when the analysis is triggered, SonarLint needs to make sure the files are saved (editor contents flushed to disk), otherwise old copies of the file might be analyzed.
We've already did changes so that this is not done if all analyzers that are being used support reading directly from the editor:

Which analyzers are you using? A list should be given in the SonarLint console when you start it up. Do you confirm that you are using the connected mode? 



--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/cad5a883-b9c4-465a-a95b-2be5a7fa1d16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Duarte Meneses | SonarSource
Software Engineer

Are you using SonarLint in your IDE?

alix....@gmail.com

unread,
Aug 17, 2017, 10:11:14 AM8/17/17
to SonarLint, alix....@gmail.com
Hi,

thanks for your swift response.
I'm not seeing a list of analyzers in the SonarLint console, but this project contains Javascript, SCSS and JSON according to SonarQube.

I will check your JIRA references

/ Alix


Den torsdag 17 augusti 2017 kl. 16:03:27 UTC+2 skrev duarte.meneses:
Hi,

Old code analyzers read the source files from disk, so when the analysis is triggered, SonarLint needs to make sure the files are saved (editor contents flushed to disk), otherwise old copies of the file might be analyzed.
We've already did changes so that this is not done if all analyzers that are being used support reading directly from the editor:

Which analyzers are you using? A list should be given in the SonarLint console when you start it up. Do you confirm that you are using the connected mode? 


On 17 August 2017 at 15:58, <alix....@gmail.com> wrote:
In a web project using webpack it is convenient to make some changes and then manually trigger a recompilation. This works as expected in IntelliJ unless checking the checkbox "Automatically trigger analysis" for SonarLint.
When this checkbox is enabled, every time you are done with a line of code and press Enter it will auto-save and trigger webpack to rebuild the project.

I think that SonarLint should respect the settings in IntelliJ regarding when to save and only then trigger an analysis, instead of force-saving to be able to analyze. Any thoughts on this?

SonarLint version: 3.0.0.2041

--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+...@googlegroups.com.

Duarte Meneses

unread,
Aug 17, 2017, 10:23:46 AM8/17/17
to SonarLint
The analyzers only get logged when SonarLint starts up the first time, so try restarting the IDE and check the SonarLint console.
It's important to know the version too, as the behaviour might differ depending on the version of the analyzer.

To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/f2ed3715-9467-488f-b9d4-2c6c19e002b6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

cli...@gmail.com

unread,
Aug 18, 2017, 6:22:39 AM8/18/17
to SonarLint
Hi,

I'm not finding these logs. This is what I see:

Using configuration of 'XXX in server 'SonarQube'
Using storage for server 'SonarQube' (last update 2017-08-17 16:07)
Analysing 4 files...
Index files
4 files indexed
Found 0 issues
Check for updates from server 'SonarQube'...
Check for updates from server 'SonarQube' for project 'XXX'...
  - Quality profile 'XYZ' for language 'SCSS' updated
Using storage for server 'SonarQube' (last update 2017-08-18 12:21)
Server binding 'SonarQube' updated

cli...@gmail.com

unread,
Aug 18, 2017, 6:23:43 AM8/18/17
to SonarLint, cli...@gmail.com
I can give you a list of the plugins from SonarQube and their versions if you want?

alix....@gmail.com

unread,
Aug 18, 2017, 6:32:29 AM8/18/17
to SonarLint, cli...@gmail.com
... Same person, wrong logged in account :-)

/Alix

Duarte Meneses

unread,
Aug 18, 2017, 6:48:03 AM8/18/17
to Cliq Go DevTeam, SonarLint
Yes.
FYI these are the versions of the plugins that support reading the source code from the editor: 

To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/09ce9650-a79c-43d2-a2f2-fd0d6424b57d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

alix....@gmail.com

unread,
Aug 18, 2017, 6:59:18 AM8/18/17
to SonarLint, cli...@gmail.com
Hi, all of these that are used are up-to-date and should be fine.

Java 4.12.0.11.033
Javascript 3.1.1.5128
XML 1.4.3.1027

I'm suspecting the CSS plugin (3.1), JSON plugin (2.2) or Web plugin (2.5.0.476) that is relevant to this project but not in your list. Of course there are other plugins installed also but maybe they are not used as there is no code that is relevant?

Duarte Meneses

unread,
Aug 18, 2017, 7:16:58 AM8/18/17
to SonarLint
Hi,
To see the list of plugins loaded by SonarLint on startup, please enable the debug logs (and restart the IDE). You should see something like this:

Load plugins (done) | time=4ms
Plugins:
  * SonarPHP 2.10.0.2087 (php)
  * SonarPython 1.8.0.1496 (python)
  * SonarJava 4.10.0.10260 (java)
  * SonarJS 3.1.0.5111 (javascript)

All the plugins loaded by SonarLint are relevant, even if it's not used in a particular analysis. There are some plugins that can be loaded by SonarLint if they are installed in SonarQube and are not in the list because no version will read from the editor.



To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/6c05c16f-ab6d-4391-baef-c1e964c1209b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

alix....@gmail.com

unread,
Aug 18, 2017, 7:37:22 AM8/18/17
to SonarLint
How do I enable debug logs? IntelliJ wants me to specify a log category or similar. 

Duarte Meneses

unread,
Aug 18, 2017, 7:39:06 AM8/18/17
to SonarLint
There is a screenshot in this FAQ.

To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/95fe9eea-2af7-4dca-938d-44c0e94b32c6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

alix....@gmail.com

unread,
Aug 18, 2017, 8:12:01 AM8/18/17
to SonarLint
Thanks.

Here is the output:

Load plugins
Plugin css is not compatible with SonarLint. Skip it.
Plugin pmd is not compatible with SonarLint. Skip it.
Plugin android is not compatible with SonarLint. Skip it.
Plugin JSON is not compatible with SonarLint. Skip it.
Plugin widgetlab is not compatible with SonarLint. Skip it.
Plugin scmsvn is not compatible with SonarLint. Skip it.
Plugin javaProperties is not compatible with SonarLint. Skip it.
Plugin findbugs is not compatible with SonarLint. Skip it.
Plugin csharp is not compatible with SonarLint. Skip it.
Plugin groovy is not compatible with SonarLint. Skip it.
Plugin web is not compatible with SonarLint. Skip it.
Plugin scmgit is not compatible with SonarLint. Skip it.
Plugin xml is not compatible with SonarLint. Skip it.
Plugin rci is not compatible with SonarLint. Skip it.
Plugin lua is not compatible with SonarLint. Skip it.
Plugin timeline is not compatible with SonarLint. Skip it.
Plugin checkstyle is not compatible with SonarLint. Skip it.
Plugin status is not compatible with SonarLint. Skip it.
Load plugins (done) | time=63ms
Plugins:
  * SonarPython 1.8.0.1496 (python)
  * SonarCFamily 4.11.0.8443 (cpp)
  * SonarJava 4.12.0.11033 (java)
  * SonarJS 3.1.1.5128 (javascript)
  * SonarSwift 2.1.0.1504 (swift)

Duarte Meneses

unread,
Aug 18, 2017, 8:40:22 AM8/18/17
to SonarLint
Thanks. So it seems that the culprit is the swift plugin. Unfortunately there is no version of this plugin that is capable of reading the file contents from the editor. 
Currently the only solution to stop SonarLint from saving the files would be to remove the swift plugin.

To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/959ebbf1-3861-41e9-a7f4-19598f8b84bd%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

alix....@gmail.com

unread,
Aug 18, 2017, 8:55:16 AM8/18/17
to SonarLint
OK, that's great that we know what the problem is. 
Maybe this should be in someones backlog? 

Thanks for your efforts
/ Alix
Message has been deleted

Janos Gyerik

unread,
Aug 18, 2017, 9:22:42 AM8/18/17
to SonarLint, alix....@gmail.com
Hi,

Yes, it's in our internal backlog ;-)
(We have a matrix of plugins and features required for analysis without saving files, getting filled gradually.)

Cheers,
Janos

On Fri, Aug 18, 2017 at 3:18 PM, <janos....@sonarsource.com> wrote:
Hi,

Yes, it's in the backlog, in the form of this matrix:

The relevant columns are the 3rd (InputFile::charset) and the 8th (read file through InputFile). When these are done for Swift, analysis without saving files will be possible.

Cheers,
Janos

--
You received this message because you are subscribed to a topic in the Google Groups "SonarLint" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarlint/ClGuFxa2KZg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/6bb34cef-0e48-4f5a-a140-e12d229d877e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Janos Gyerik | SonarSource

Software Developer

Reply all
Reply to author
Forward
0 new messages