IntelliJ | Troubleshooting

Was this page helpful?

On this page

Install Free

Troubleshooting

Knowing where to begin looking for information is the first step to reaching out for help. Many answers to commonly found problems can be found on the SonarLint channel of the Sonar Community Forum. See below for the basic steps to access the SonarLint logs when the analysis results are not what you expected.

How to get SonarLint logs

  • Open the SonarLint tool window: View > Tool Windows > SonarLint.
  • Enable the Analysis logs and Verbose output in the tool window settings.
  • Find the logs in the Log tab of the tool window.

How to get SonarLint thread dumps

In some cases, it can be useful to extract thread dumps from the running instance of your IDE for debugging; thread dumps can help us investigate UI freeze issues or threading problems. 

If SonarLint does not start or stops working and the IDE is still running, thread dumps are necessary to properly troubleshoot the problem before the IDE is restarted. If you restart the IDE, some information about what was happening when it failed will be lost. Fortunately, thread dumps are easy to obtain for both SonarLint and your IDE.

  • JetBrains IDEs have an internal mechanism to generate a thread dump. Please see the JetBrains documentation for the details.
  • If the UI is still reactive, you have another alternative: select Help > Collect Logs and Diagnostic Data to create a .zip file containing one or several threadDumps-XXX folders. In these folders, you should find one .txt file with the current date and time that will contain the logs.

Once obtained, please report your error to the Community forum. Your thread dump may contain sensitive details and if it’s required for further troubleshooting, it will be possible to share your thread dump privately.

Troubleshooting Connected Mode setup

No matching project found

No matching project is found because:

  • It's best if you already have the project open in your IDE, otherwise SonarLint might not be able to find a matching file. 
  • SonarLint can get confused if you have more than one project open in different windows. Please close the non-applicable project and try again.

If these solutions don't help, follow these instructions to manually configure the project binding.

No matching issue found

SonarLint can't find your issue because:

  • You might not be on the same branch.
  • The issue was fixed, or the source code may be different from the analyzed version.

Troubleshooting unexpected analysis results

Observing different analysis results between SonarQube/SonarCloud and SonarLint can have different causes.

Some issues might be detected by a third-party

Due to extensive resource requirements, taint vulnerability and some advanced bug detection rules are ignored by SonarLint. Please check the analyzer (PMD, Checkstyle, ESLint, PyLint, …). SonarLint will only run rules from SonarSource analyzers including custom rules extending SonarSource analyzers. Third-party analyzers usually have their own IDE integration, so we have no plan to run them in SonarLint.

Your test files might be mistaken as source files

Test files can be defined in SonarQube, on SonarCloud, or in the IDE. SonarLint for IntelliJ relies on the IDE to detect if a file is a test file, which is the case if:

  • The file is under a test sources root. Those roots can be manually created by users or automatically populated by the IDE by relying on the build system such as Maven or Gradle, for example.
  • The file is flagged as a test file by any plugin that you have installed. The IDE bundles some internal plugins like the “JavaScript and TypeScript” plugin; these internal plugins can infer if a file should be considered as a test file. Third-party plugins can also infer test files, and SonarLint will recognize these as such.

Some complex rules are not run in SonarLint

Due to extensive resource requirements, taint vulnerabilities and some advanced bug detection rules are ignored by SonarLint. Please check the SonarLint roadmap for a list of features and enhancements on the horizon.

Only line-level issues are reported

Some rules are able to report issues at the project level. Such issues are not displayed in SonarLint, only in SonarQube and SonarCloud.

When analyzing Java files, the analyzer might need some context for some issues to be found

In IntelliJ, there is no incremental compilation of the .class files found in the compiler output folder; these are only produced or refreshed when the project is built. The workaround is to simply build your project with the green hammer (when using IntelliJ) in the top-right toolbar. The project should be built on a regular basis to keep the compiled files up-to-date and overcome this known limitation.

My JS/TS analysis won't run

Analysis fails to restart 

As reported in this Sonar Community forum thread, the analysis can fail to restart when your computer goes to sleep while analyzing JavaScript or TypeScript files with SonarLint for IntelliJ.

  • To solve the issue, simply restart IntelliJ and reopen your project.
  • To check if this is the problem, enable the Analysis logs and Verbose output in the tool window settings and re-trigger an analysis; then look for the Skipping the start of the bridge server [...] error notice.

Slow or unresponsive analysis

On a big project, more memory may need to be allocated to analyze the project. This would be manifested by analysis getting stuck. You can use the sonar.javascript.node.maxspace property to allow the analysis to use more memory. Set this property to 4096 or 8192 for big projects. This property should be set in your SonarLint plugin settings in the IDE.

FAQ

I have configured some SonarScanner properties. Are they applied to SonarLint?

No. Scanner properties you may have defined in the sonar-project.properties or pom.xml files (for example sonar.sources or sonar.projectBasedir) only make sense when using the SonarScanner in the command line. SonarLint tries to use IDE metadata to avoid other configurations. 

If you want to share some configuration between SonarScanners and SonarLint, like File exclusions, or some specific analyzer properties, the best way is to use Connected Mode and set the configuration in the SonarQube or SonarCloud UI.

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARLINT, SONARQUBE, SONARCLOUD, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License