44

Is there some way of turning-off automatic SonarLint analysis in Intellij IDEA?

I have some 10,000 to 20,000 lines-of-code classes (don't ask, not my fault, trying to refactor). Every time I edit even a single character in the class, the SonarLint plugin makes IDEA unusable for a few minutes.

It is not possible to save the "Automatically trigger analysis" checkbox in the unchecked state in Other Settings > SonarLint General Settings. Is there some other solution to my problem? I really want to use the plugin. I just can't use it in automatic mode.

Derek Bennett
  • 807
  • 1
  • 7
  • 14
  • Are you sure that it happens coz of SonarLint? Whether your project has hundreds of classes, sonarlint can analyze only the currently opened file(s). And 'automatically trigger analysis' normally doesn't make such an issue. – Supun Wijerathne Aug 27 '16 at 01:43
  • This is a corner case but which should be handled properly by SonarLint. Based on this question I've created the following thread of discussion on the SonarLint Google Group : https://groups.google.com/d/msg/sonarlint/PNH2JlgwQw8/hTSbeCTtCwAJ – Freddy - SonarSource Team Aug 29 '16 at 15:01
  • Yes, this is absolutely because of SonarLint. Each character I edit triggers an analysis. Each analysis of my 10KLOC file takes 10s of seconds and consumes most CPU. I need to be able to turn-off automatic analysis and trigger each analysis run by hand. – Derek Bennett Aug 30 '16 at 21:37
  • 1
    It's absolutely necessary to have an option to quickly turn off analysis, even automatically triggered, as it hangs the IDE. We want want to have analysis performed only as we really need it, not interfering incessantly, with IDE hang, or at least option to stop it. But we don't have the option, like stop button for now. Well, we have 'Stop' button, but it can not stop auto triggered checks. It shouldn't be hard to provide the option. – WebComer Jun 17 '18 at 12:05
  • 13
    @WebComer you can disable the automatic analysis in Settings -> Other Settings -> SonarLint General Settings. – Duarte Meneses Jun 19 '18 at 08:22

4 Answers4

35

For intellij:

Go to File -> Settings New window will open In new window Expand tools -> locate SonarLint and click on it. Under settings tab of SonarLint -> uncheck the box 'Automatically trigger Analysis'. enter image description here

sway
  • 361
  • 3
  • 3
14

Go to File -> Settings -> Other Settings -> SonarLint General Settings then uncheck the Automatically trigger analysis check box

Natsen
  • 181
  • 1
  • 6
7

There was a bug in SonarLint for IntelliJ that prevented the configuration to be properly saved.

It was fixed in the latest version 2.3.2: https://jira.sonarsource.com/browse/SLI-106

About the performance, please make sure you are using the Java analyzer 4.2, as you might be experiencing this problem: https://jira.sonarsource.com/browse/SLI-100.

It is embedded in the latest SonarLint, but if you use the connected mode, you also need to check which version of the Java analyzer is installed in the SonarQube server.

We are always trying to improve performance, so feel free to open a topic in the SonarLint Google group with the verbose analysis log so that we can investigate why it takes so long to analyze the file.

Duarte Meneses
  • 2,868
  • 19
  • 22
  • 4
    There should be an option to stop analysis when needed, see my comment below the question. – WebComer Jun 17 '18 at 12:06
  • 1
    I think this is right it needed (There should be an option to stop analysis when needed, see my comment below the question.) – Tefa Oct 09 '18 at 15:37
1

In Android Studio 3.5.2: Go to File -> Settings -> Tools -> SonarLint -> Settings(Tab) then uncheck the Automatically trigger analysis check box.