4

I went through the documentation of spotbug https://spotbugs.readthedocs.io/en/stable/

However information on false positive is not comprehensive.

Kindly help me with the steps to mark certain bug reported as false positive and so that those are not part of the report anymore.

P.S. - SuppressFBWarnings cannot be used in our case.

subir
  • 310
  • 4
  • 13
  • We use an XML file for specifying “bugs” that SpotBugs should ignore (we used the same XML file for FindBugs, it works with SpotBugs too). – Ole V.V. Aug 30 '18 at 08:52
  • Thanks Ole. Kindly let me know if your XML file is like this and you add the filename in the of spotbugs maven plugin: " " – subir Aug 30 '18 at 10:10
  • Yes, it looks like that. We’re not using Maven, so I just run SpotBugs from Eclipse and configure it in Eclipse Prefs to use the filter file. What happens on out build server I don’t know, but it runs SpotBugs with the filter file too. – Ole V.V. Aug 30 '18 at 10:49
  • @subir Can you move your alternative to the answers section. – h3xStream Sep 04 '18 at 19:01

1 Answers1

4

Thanks Ole. The XML file is like this and one has to add the filename in the of spotbugs maven plugin in pom file:

<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
  <Match>
    <Class name="com.foobar.MyClass" />
    <Method name="someMethod" />
    <Bug pattern="DLS_DEAD_LOCAL_STORE" />
    <Priority value="2" />
  </Match>
</FindBugsFilter>
andersonvom
  • 11,701
  • 4
  • 35
  • 40
subir
  • 310
  • 4
  • 13