SonarLint in IDEA kills performance in big files

2,186 views
Skip to first unread message

CSchulz

unread,
Jul 5, 2016, 6:55:21 AM7/5/16
to SonarLint
I have noticed that SonarLint analyses files when I open then regardless if they are part of the configured sources (project settings in IDEA) or not.

Sometimes the files are very big (30k lines) and it slows down the application a lot.

Is there the possibility to utilize less resources when scanning a file?

Duarte Meneses

unread,
Jul 7, 2016, 11:42:22 AM7/7/16
to CSchulz, SonarLint
Java files should only be automatically analyzed if they are configured as sources (and are not generated sources).
Could you double check the project structure? Which version of IntelliJ are you using?

It's also possible to disable the automatic trigger of analysis in the SonarLint General Settings.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/e16e5f37-00fd-4cd3-a8cf-0312d9f403d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Duarte MENESES | SonarSource

Julien HENRY

unread,
Jul 7, 2016, 11:46:54 AM7/7/16
to SonarLint
Hi,

@duarte this is JS file here.

My understanding is that JavaScript files are not always part of source folders so we can't apply same strategy than we do for Java files but maybe I'm wrong. 

Also is this file minified?

++

Julien

goyette.marcandre

unread,
Jul 8, 2016, 7:13:47 AM7/8/16
to SonarLint
Hi,

unfortunately, Java files greater than 10k that are not generated are sometimes found in legacy Java projects even if it's a bad practice.

I've seen that with SonarLint for Eclipse, huge Java files don't cause Eclipse to lag that much if Eclipse has enough memory.

However, SonarLint for IntelliJ lags more with these files then Eclipse after one of them is opened (the editor can stop to be responsive for a good amount of time). If a Java project has one or many of these huge Java files, the solution is to disable the automatic trigger of analysis. If the IDE has big performance issue when huge files are opened (not even edited), many developers will prefer to run SonarLint manually. But IntelliJ without SonarLint already has trouble with huge Java files, so it's not like SonarLint is the only cause of the lag.

Huge Java files could also be a reason why someone would try to use sonar.exclusions to force the exclusions of some huge Java classes that are part of the source folders.

Duarte Meneses

unread,
Jul 8, 2016, 7:42:15 AM7/8/16
to goyette.marcandre, SonarLint
Yes, for Javascript files we don't apply the same strategy because they are often outside the source roots. Also note that other flavors of IntelliJ don't have the concept of source roots (even though the behavior could be different for those IDEs if needed).

For large Java files within the source roots where the analysis is too slow, the solution is indeed to disable automatic analysis. 

For both cases, we plan to support file exclusions soon: https://jira.sonarsource.com/browse/SLI-72.

--
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.

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

CSchulz

unread,
Jul 14, 2016, 4:57:50 AM7/14/16
to SonarLint, goyette....@gmail.com
Thanks for the reply. Yes it is indeed a JavaScript file.

Does the exclusions work with the general project settings or are they different and only for sonarlint?

Duarte Meneses

unread,
Jul 14, 2016, 5:20:07 AM7/14/16
to CSchulz, SonarLint, Marc-André Goyette
What do you mean with general project settings?
Currently, there is no way to define file exclusions in SonarLint. We plan to support it in future versions.


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

CSchulz

unread,
Jul 14, 2016, 7:19:07 AM7/14/16
to SonarLint, chri...@schulz.re, goyette....@gmail.com
I am sorry to be unclear. I meant the general project settings on SonarQube side. Administration -> General Settings -> Analysis Scope -> Files.
Reply all
Reply to author
Forward
0 new messages