Open TheLoneKing opened 4 years ago
I can't reproduce the problem: You have enabled the “Dodgy code (STYLE)“ checkbox and a “FindNullDeref“ one, right? | Dodgy code (STYLE) | FindNullDeref |
---|---|---|
If it's that, provide a minimal code example for which IntelliJ SpotBugs plugin doesn't catch a bug.
We have a similar issue. Spotbugs Maven plugin finds many bugs that Intellij's plugin doesn't . In our platform, both instances are producing different results. InteliiJ's is configured to consider all "Reports" and "Detectors", while Maven's is running on default settings. In the depicted example we are using an "inclusion" xml file to narrow down the results and quicken the test. It's configuration works properly via Maven and seems to be working normally in Intellij as well. The project has no suppression annotations. The problem has been reproduced locally both in 2019.3 and 2020.1 versions on 2 different computers. We use OSX Catalina, Java 1.8. Plugin version is 1.1.0.
Unfortunately, I could not yet reproduce the problem on a minimal code example. It seems you need a mass of occurrences for the problem to arise.
@jqyp Yes, I have enabled all necessary settings.
Here's the result of scanning the code with Spotbugs Intellij plugin (problem is in addNewItems
method):
Same code scanned with maven plugin reports error:
I can simulate this using a simple SpringBoot Application:
BTW, the error is a false positive, trimAllWhitespace
is null safe
Hi, same problem here :/
We had an exercise at university to learn about SpotBugs and the SpotBugs via maven plugin
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.2.0</version>
<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs</artifactId>
<version>4.2.3</version>
</dependency>
</dependencies>
</plugin>
works fine: it finds all bugs in the exercise. But the "SpotBugs plugin 1.2.4 with SpotBugs version 4.1.3" finds not a single bug. They are also quite obvious: even IntelliJ highlights them. What am I doing wrong?
I can also provide a minimal working code example:
public class Student {
private String firstName;
public Student(String firstName) {
setFirstName(firstName);
}
public void setFirstName(String firstName) {
this.firstName.replaceAll("[^A-Za-z]", "");
}
public static void main(String[] args) {
Student oliver = new Student("Oliver");
}
}
the bug is in line 10: this.firstName.replaceAll("[^A-Za-z]", "");
instead of this.firstName=firstName.replaceAll("[^A-Za-z]", "");
The Sputbugs IDEA plugin is just giving me this answer:
it says no class files found but if I click on "more" it says the class Student has been analysed.
maven on the other side:
I'm using both maven and IDEA plugin with default setting.
Im using: IntelliJ IDEA 2021.1.3 (Ultimate Edition) Build #IU-211.7628.21, built on June 30, 2021 Non-Bundled Plugins: org.jetbrains.plugins.spotbugs (1.2.4),
+1
I have the same issue as described in 14.4.1 (23E224).
mvn
detects an intentional violation as expected.IntelliJ IDEA:
Spotbugs IntelliJ Plugin:
OS:
Java:
The spotbugs maven plugin reports the
NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
bug in a couple of places in my code. However, when I analyze the same project Intellij, the plugin is not catching those bugs.The spotbugs configuration on my Intellij IDE is as below: Analysis effort: Maximal Minimum rank: 20 - Of Concern Minimum confidence: Low
I have also enabled all the providers.
Here's my maven plugin config: