1. SonarLint Not Showing Issues in IDE

Understanding the Issue

SonarLint fails to highlight issues in the IDE, or analysis does not trigger automatically.

Root Causes

  • SonarLint plugin not properly installed or enabled.
  • Incorrect binding with SonarQube or SonarCloud.
  • Project not configured correctly for static analysis.

Fix

Ensure SonarLint is installed and enabled in your IDE (e.g., IntelliJ IDEA, VS Code, Eclipse):

Help → Plugins → Search for SonarLint → Install

Manually trigger analysis:

Right-click on the project → SonarLint → Analyze

For connected mode with SonarQube, ensure proper binding:

Settings → SonarLint → Add connection → Provide SonarQube token

2. SonarLint Showing False Positives

Understanding the Issue

SonarLint flags valid code as problematic, causing unnecessary warnings.

Root Causes

  • Rules not properly customized for the project.
  • Misinterpretation of language constructs.
  • SonarLint using outdated rule configurations.

Fix

Suppress false positives using annotations:

@SuppressWarnings("java:S106") // Suppress specific SonarLint rule

Update SonarLint rule configurations:

Settings → SonarLint → Rules → Enable/Disable specific rules

If connected to SonarQube, update the rule set in SonarQube and synchronize with SonarLint.

3. SonarLint Performance Issues

Understanding the Issue

SonarLint slows down IDE performance, causing lags during coding.

Root Causes

  • Real-time analysis consuming too many system resources.
  • Large project size with complex dependency structures.
  • Too many active SonarLint rules.

Fix

Disable real-time analysis for better performance:

Settings → SonarLint → General → Uncheck "Analyze files as you type"

Manually trigger analysis instead of automatic checks:

Right-click project → SonarLint → Analyze

Reduce the number of active rules:

Settings → SonarLint → Rules → Disable unnecessary rules

4. SonarLint Not Synchronizing with SonarQube

Understanding the Issue

SonarLint does not apply SonarQube’s custom rules or fails to synchronize settings.

Root Causes

  • Invalid authentication token for SonarQube.
  • Network connectivity issues preventing synchronization.
  • Project binding mismatch between SonarLint and SonarQube.

Fix

Rebind the project with SonarQube:

Settings → SonarLint → Manage Connections → Add SonarQube server

Check SonarQube token validity:

SonarQube → User Profile → Security → Generate New Token

Ensure network connectivity and proxy settings allow access to SonarQube:

Settings → Network → Configure proxy for SonarQube

5. SonarLint Not Scanning Certain Files

Understanding the Issue

SonarLint does not analyze certain files or ignores specific code sections.

Root Causes

  • Excluded file patterns in SonarLint settings.
  • Unsupported file types for analysis.
  • Project structure issues preventing proper indexing.

Fix

Ensure files are included in analysis settings:

Settings → SonarLint → File Exclusions → Remove unnecessary exclusions

Verify supported file types in the SonarLint documentation.

Refresh project indexing in the IDE:

File → Invalidate Caches / Restart

Conclusion

SonarLint is a powerful tool for maintaining code quality, but troubleshooting IDE integration issues, false positives, performance slowdowns, synchronization problems, and scanning exclusions is essential for effective usage. By optimizing rule configurations, managing resource usage, and ensuring proper SonarQube integration, developers can maximize SonarLint’s effectiveness in detecting and resolving code issues.

FAQs

1. Why is SonarLint not highlighting issues in my IDE?

Ensure the plugin is installed, rebind the project, and manually trigger analysis.

2. How do I suppress false positives in SonarLint?

Use @SuppressWarnings annotations or disable specific rules in SonarLint settings.

3. How can I improve SonarLint performance?

Disable real-time analysis, reduce active rules, and analyze manually instead of automatically.

4. Why is SonarLint not syncing with SonarQube?

Verify authentication tokens, check network settings, and ensure the correct project binding.

5. How do I enable SonarLint analysis for all files?

Remove file exclusions in settings and ensure the IDE indexes project files correctly.