You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Glen Mazza (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2011/10/01 02:31:46 UTC
[jira] [Issue Comment Edited] (CXF-3839) Refactoring to decrease
code 'duplications' percentage to under 5 percent.
[ https://issues.apache.org/jira/browse/CXF-3839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13118597#comment-13118597 ]
Glen Mazza edited comment on CXF-3839 at 10/1/11 12:30 AM:
-----------------------------------------------------------
Looking at Sonar, for the following source code[1]:
{noformat}
1 public File getOutputDir() {
2 return outputDir;
3 }
4
5 public void setOutputDir(File f) {
6 outputDir = f;
7 }
8
{noformat}
As best I can tell, Sonar is claiming that lines 3 and 7 are duplicates as well as 4 and 8. But there's absolutely nothing wrong with lines of space between methods or having the closing brace on its own line--indeed, it's what we need to please checkstyle. For POJO's that have lots of little methods like these, you're going to have a high percentage of what Sonar calls "duplicate lines".
Our checkstyle and PMD give us sufficiently clean code, trying to please SONAR (at least with this metric) is unnecessary IMO.
[1] http://nemo.sonarsource.org/resource/index/org.apache.cxf:cxf-codegen-plugin:org.apache.cxf.maven_plugin.Option?tab=org.sonar.plugins.core.duplicationsviewer.DuplicationsViewer
was (Author: gmazza):
Looking at Sonar, for the following source code[1]:
1 public File getOutputDir() {
2 return outputDir;
3 }
4
5 public void setOutputDir(File f) {
6 outputDir = f;
7 }
8
As best I can tell, Sonar is claiming that lines 3 and 7 are duplicates as well as 4 and 8. But there's absolutely nothing wrong with lines of space between methods or having the closing brace on its own line--indeed, it's what we need to please checkstyle. For POJO's that have lots of little methods like these, you're going to have a high percentage of what Sonar calls "duplicate lines".
Our checkstyle and PMD give us sufficiently clean code, trying to please SONAR (at least with this metric) is unnecessary IMO.
[1] http://nemo.sonarsource.org/resource/index/org.apache.cxf:cxf-codegen-plugin:org.apache.cxf.maven_plugin.Option?tab=org.sonar.plugins.core.duplicationsviewer.DuplicationsViewer
> Refactoring to decrease code 'duplications' percentage to under 5 percent.
> --------------------------------------------------------------------------
>
> Key: CXF-3839
> URL: https://issues.apache.org/jira/browse/CXF-3839
> Project: CXF
> Issue Type: Improvement
> Affects Versions: 2.5
> Reporter: Robert Liguori
> Priority: Minor
>
> Sonar currently flags Apache CXF as exceeding the duplications benchmark of 5 % at 5.2 %; http://nemo.sonarsource.org/dashboard/index/117804?did=1.
> The alert states, "Warn Alerts : ... Duplicated lines (%) > 5.
> Since it's only exceeded by .2 %, I thought it would be a worthy effort (software quality-wise) to attempt to refine/refactor the code so the alert is not produced.
> ... that is get the current duplications percentage of 5.2 % to under 5%, so the alert is not shown.
> Thanks!
> Note: I am more 'test' than I am 'development', but I'll take a look into this as well, to see what can be refactored, if anything..
> This issue can be closed, when the percentage is under 5 %. Thanks again.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira