New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detected bugs not show in site reports #891
Comments
Thanks for opening your first issue here! 😃 |
mcve:
...
</pluginManagement>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.11</version>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
<xmlOutput>true</xmlOutput>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.11</version>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
<xmlOutput>true</xmlOutput>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</reporting>
...
public class App
{
Object myFunc(){
return new Object() {
@Override
public String toString(){
return "Object";
}
};
}
...
}
You will get
<?xml version='1.0' encoding='UTF-8'?>
<BugCollection version='3.1.11' threshold='low' effort='max'><file classname='com.mycompany.app.App'><BugInstance type='SIC_INNER_SHOULD_BE_STATIC_ANON' priority='Low' category='PERFORMANCE' message='The class com.mycompany.app.App$1 could be refactored into a named _static_ inner class' lineNumber='10'/></file><Error></Error><Project><SrcDir>/my-app/src/main/java</SrcDir><SrcDir>/my-app/src/test/java</SrcDir></Project></BugCollection>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- Generated by Apache Maven Doxia Site Renderer 1.8.1 from com.github.spotbugs:spotbugs-maven-plugin:3.1.11:spotbugs at 2019-03-01 -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>my-app – SpotBugs Bug Detector Report</title>
<style type="text/css" media="all">
@import url("./css/maven-base.css");
@import url("./css/maven-theme.css");
@import url("./css/site.css");
</style>
<link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
<meta http-equiv="Content-Language" content="en" />
</head>
<body class="composite">
<div id="banner">
<div id="bannerLeft">
my-app
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<span id="publishDate">Last Published: 2019-03-01</span>
| <span id="projectVersion">Version: 1.0-SNAPSHOT</span>
</div>
<div class="xright"><a href="./" title="my-app">my-app</a> </div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>Project Documentation</h5>
<ul>
<li class="collapsed"><a href="project-info.html" title="Project Information">Project Information</a></li>
<li class="expanded"><a href="project-reports.html" title="Project Reports">Project Reports</a>
<ul>
<li class="none"><strong>SpotBugs</strong></li>
</ul></li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="poweredBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<div class="section">
<h2><a name="SpotBugs_Bug_Detector_Report"></a>SpotBugs Bug Detector Report</h2>
<p>The following document contains the results of <a class="externalLink" href="https://spotbugs.github.io/">SpotBugs</a></p>
<p>SpotBugs Version is <i>3.1.11</i></p>
<p>Threshold is <i>low</i></p>
<p>Effort is <i>max</i></p></div>
<div class="section">
<h2><a name="Summary"></a>Summary</h2>
<table border="0" class="bodyTable">
<tr class="a">
<th>Classes</th>
<th>Bugs</th>
<th>Errors</th>
<th>Missing Classes</th></tr>
<tr class="b">
<td>2</td>
<td>1</td>
<td>0</td>
<td>0</td></tr></table></div>
<div class="section">
<h2><a name="Files"></a>Files</h2>
<table border="0" class="bodyTable">
<tr class="a">
<th>Class</th>
<th>Bugs</th></tr>
<tr class="b">
<td><a href="#com.mycompany.app.App">com.mycompany.app.App</a></td>
<td>1</td></tr></table></div><a name="com.mycompany.app.App"></a>
<div class="section">
<h3><a name="com.mycompany.app.App"></a>com.mycompany.app.App</h3>
<table border="0" class="bodyTable">
<tr class="a">
<th>Bug</th>
<th>Category</th>
<th>Details</th>
<th>Line</th>
<th>Priority</th></tr></table></div>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">
Copyright © 2019.All rights reserved. </div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html> |
Maybe this should be moved to spotbugs/spotbugs-maven-plugin? If that is the case, I will close this one, and open a new one there. |
Possibly. It depends on exactly where the issue is, but if it's specific to the reports generated by the Maven plugin, then that's probably best. |
@schemacs Just seen this, don't think you opened anything on spotbugs and it was not moved. Is this still occurring on latest? |
No SIC_INNER_SHOULD_BE_STATIC_ANON bugs show in site report(target/site/spotbugs.html), but all three bugs are showed on console by running
mvn spotbugs:spotbugs
, and also in target/spotbugs.xml。The text was updated successfully, but these errors were encountered: