Install Free
IntelliJ | Troubleshooting

Troubleshooting

On this page

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 SonarQube for IDE 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.

Before posting to the Community, make sure that you have your logs ready by following the instructions below.

How to get SonarQube for IDE logs

  • Open the SonarQube for IDE tool window: View > Tool Windows > SonarQube for IDE.
  • 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 SonarQube for IDE 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 SonarQube for IDE 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 SonarQube for IDE might not be able to find a matching file. 
  • SonarQube for IDE 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

SonarQube for IntelliJ 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

Sometimes, issues found on the server differ from those found locally by SonarQube for IDE. Usually, the server-side rule configuration (your quality profile) is to blame; however, it could be something more than that. Maybe your local build configuration and system dependencies don’t align with your DevOps pipeline, or it could simply be that the issue, due to its complexity, is only detectable by SonarQube or SonarCloud. 

The collapsible below lists some of the most commonly encountered reasons, along with some details that will help you troubleshoot discrepancies. 

Why your local analysis might be different than found on the server

Some issues might be detected by third-party analyzers

SonarQube for IDE will only run rules from SonarSource analyzers including custom rules extending SonarSource analyzers. Third-party analyzers usually have their own IDE integration, and there is no plan to run them inside of SonarLint.

Your test files might be mistaken as source files

Test files can be defined in SonarQube Server, on SonarQube Cloud, or in the IDE. SonarQube 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 rules are too complex to run locally

Some rules can report issues at the project level or require extensive resources to analyze, such as injection vulnerabilities and some advanced bug detection rules; such issues are not displayed in SonarLint, only in SonarQube Server and SonarQube Cloud. Please check the SonarQube for IDE roadmap for a list of features and enhancements on the horizon.

File or language types are not supported

Check your IDE’s Rules and languages page for a list of supported languages and file types.

The analyzer version may be different

Improvements are constantly being made to the Sonar analyzers during the CI/CD development cycle. Depending on the product version you are running, you may have a different analyzer therefore, the results might be different.

  • SonarQube Cloud is always running the latest analyzers.
  • SonarQube Server and SonarQube Community Build runs the latest available analyzer at the time of its release.
  • SonarQube for IDE runs the latest available analyzer at the time of its release.
  • Sometimes SonarQube for IDE downloads and uses the same SonarQube Server or SonarQube Cloud analyzer when running in connected mode.

Your project configuration may be different

Discrepancies in C and C++ analysis may result from different project builds and system dependencies. For example, you might have one set up in your local build configuration and another set up for your CI build configuration (or the configuration created by Autoscan).

Language-specific troubleshooting

Language-specific troubleshooting

Java analysis

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.

JS/TS analysis

My JS/TS 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 SonarQube 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.

My JS/TS analysis is slow or unresponsive

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 SonarQube for IDE plugin settings in the IDE.

FAQ

Are my SonarScanner properties applied to SonarQube for IDE?

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. SonarQube for IDE tries to use IDE metadata to avoid other configurations. 

If you want to share some configuration between SonarScanners and SonarQube for IDE, like File exclusions, or some specific analyzer properties, the best way is to use Connected Mode and set the configuration in the SonarQube (Server, Cloud) UI.


Was this page helpful?

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

Creative Commons License