Questions tagged [sonarlint]

SonarLint is an extension to IDEs (such as VS, Eclipse or IntelliJ) that provides on-the-fly feedback to developers on new bugs and quality issues found in their code, using Static Code Analysis.

SonarLint is an extension to IDEs (such as VS, VS Code, Eclipse, PyCharm, etc) that provides on-the-fly feedback to developers on new bugs and quality issues found in their code, using Static Code Analysis.

© 2008-2018, SonarSource S.A, Switzerland

Currently available:

693 questions
127
votes
5 answers

SonarQube And SonarLint difference

How exactly is sonarQube different from SonarLint ? SonarQube has a server associated with it and Sonar lint works more like a plugin. But what are their specific difference ?
Jeevan Varughese
  • 2,159
  • 2
  • 15
  • 20
76
votes
2 answers

How to suppress warning for a specific method with Intellij SonarLint plugin

I want to suppress the Sonar lint plugin warning for some methods. This question is not what I want Intellij SonarLint 2.3 - ignore rule. Currently I have to annotate the method with @SuppressWarnings("all"),which suppresses all warnings.
aristotll
  • 8,694
  • 6
  • 33
  • 53
44
votes
4 answers

How to turn off SonarLint automatic triggering on IntelliJ IDEA

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…
Derek Bennett
  • 807
  • 1
  • 7
  • 14
38
votes
4 answers

Built-in string formatting vs string concatenation as logging parameter

I'm using SonarLint that shows me an issue in the following line. LOGGER.debug("Comparing objects: " + object1 + " and " + object2); Side-note: The method that contains this line might get called quite often. The description for this issue…
Naxos84
  • 1,890
  • 1
  • 22
  • 34
36
votes
4 answers

How to use SonarLint in Eclipse

I was assigned to use SonarQube for code quality. But while I'm downloading it's plugin to Eclipse I understood it is deprecated and new one is SonarLint. But as so far I couldn't find any good documentation to how to use SonarLint. How to check…
Dil.
  • 1,996
  • 7
  • 41
  • 68
34
votes
4 answers

How do you customize SonarLint rules in IntelliJ IDEA?

Is it possible to have SonarLint for IntelliJ IDEA enforce only the rules I have enabled on my Sonar server?
Daniel Smith
  • 553
  • 1
  • 6
  • 12
31
votes
2 answers

Cognitive Complexity and its effect on the code

W.r.t to one of the java projects, we recently started using SonarLint. Output of the code analysis shows too many critical code smell alerts. Critical code smell: Refactor this method to reduce its Cognitive Complexity. I have heard about…
vmorusu
  • 936
  • 1
  • 15
  • 32
29
votes
3 answers

Refactor this method to reduce its Cognitive Complexity from 21 to the 15 allowed. How to refactor and reduce the complexity

how to reduce the complexity of the given piece of code? I am getting this error in Sonarqube---> Refactor this method to reduce its Cognitive Complexity from 21 to the 15 allowed. this.deviceDetails = this.data && {...this.data.deviceInfo} || {}; …
sd_30
  • 576
  • 1
  • 6
  • 21
26
votes
5 answers

SonarLint Use the primitive boolean expression here

I have the following class Properties: class Properties { private Boolean enabled; public Boolean getEnabled() { return enabled; } } If I write the following code, SonarLint gives me a warning on the if condition saying "Use…
findusl
  • 2,454
  • 8
  • 32
  • 51
24
votes
1 answer

Sonarlint command line version dropped?

It would appear that Sonarsource has discontinued development on the command line instance of the sonarlint tool. The link to the page on the sonarlint website now returns a 404 and there is no mention of the product on the sonarlint website. Does…
damon Jebb
  • 351
  • 3
  • 5
20
votes
2 answers

How to configure the rule set of SonarLint in Visual Studio Code?

I have installed sonar lint extension on my visual studio code editor and I was wondering if there is a way to enable or disable the rules which are used by the analyzer? There is a way to do it in Visual Studio and Eclipse but I couldn't find a way…
ShellZero
  • 4,415
  • 12
  • 38
  • 56
20
votes
3 answers

Method has 8 parameters, which is greater than 7 authorized

When I am scanning code with sonar lint the following code shows the bug as "Method has 8 parameters, which is greater than 7 authorized" @PutMapping("/something") public List updateSomeThing(@PathVariable final SomeCode code, …
Baji Shaik
  • 1,022
  • 2
  • 10
  • 14
19
votes
4 answers

Disable sonarlint automatic analysis in Eclipse by default

We recently added SonarLint to our default Eclipse install, but only use sonarlint on some new projects. While we have been quite happy with sonarlint on these projects, having automatic analysis defaulting to on for all of our legacy projects,…
Mark Booth
  • 7,605
  • 2
  • 68
  • 92
17
votes
4 answers

Unable to Finish connecting to SonarQube server

This is going to sound like a ridiculous question, but using the SonarLint Eclipse plugin (v3.2.0) on the latest Eclipse (Oxygen), I am unable to add a new SonarQube server connection. I am working behind a company firewall, but that doesnt appear…
Gary O' Donoghue
  • 362
  • 2
  • 4
  • 15
17
votes
1 answer

Is there a way to integrate sonarlint plugin in pom.xml

I want to add sonarlint plugin to my project. When I build with maven, the plugin should be automatically enabled without my intervention. Is there a way I could do it?
pramod kumar
  • 275
  • 2
  • 12
1
2 3
46 47