Discussion:
Comments in package-info.java
Harald Wellmann
2014-02-19 17:16:47 UTC
Permalink
SonarQube 4.1.1 reports 0 % comment lines in my package-info.java,
although there is a lengthy Javadoc comment.

Is there a workaround, short of deactivating the Insufficient Comment
Density rule?

Best regards,
Harald
David Racodon
2014-02-21 21:42:06 UTC
Permalink
Hi Harald,

Every comment line above the packages declaration is considered as license
header by SonarQube. Therefore, these lines are not counted as comments.
See
http://nemo.sonarqube.org/drilldown/measures/48569?metric=comment_lines_density#for
example.

See
http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-IgnoreIssuesto
deactivate the "Comment Density" rule on these package-info.java
files.

Regards,


*David RACODON | *
*SonarSource **Senior Consultant*
http://sonarsource.com

---------------------------------------------
Sign up to our newsletter
here<http://www.sonarsource.com/company/news/newsletter/>
!
---------------------------------------------
Post by Harald Wellmann
SonarQube 4.1.1 reports 0 % comment lines in my package-info.java,
although there is a lengthy Javadoc comment.
Is there a workaround, short of deactivating the Insufficient Comment
Density rule?
Best regards,
Harald
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Harald Wellmann
2014-02-24 13:54:07 UTC
Permalink
Hi David,

thanks for the pointers. I'm just wondering why every comment above the
packages declaration is considered as a license header. My
package-info.java files typically contain a license header comment (/* ...
*/) followed by a Javadoc comment (/** ... */), followed by the package
declaration.

It should be simple to check whether or not the comment is a Javadoc
comment and count all Javadoc comment lines. Should I create a JIRA ticket
for that?

Best regards,
Harald
Post by David Racodon
Hi Harald,
Every comment line above the packages declaration is considered as license
header by SonarQube. Therefore, these lines are not counted as comments.
See
http://nemo.sonarqube.org/drilldown/measures/48569?metric=comment_lines_density#for example.
See
http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-IgnoreIssuesto deactivate the "Comment Density" rule on these package-info.java files.
Regards,
*David RACODON | *
*SonarSource **Senior Consultant*
http://sonarsource.com
---------------------------------------------
Sign up to our newsletter here<http://www.sonarsource.com/company/news/newsletter/>
!
---------------------------------------------
Post by Harald Wellmann
SonarQube 4.1.1 reports 0 % comment lines in my package-info.java,
although there is a lengthy Javadoc comment.
Is there a workaround, short of deactivating the Insufficient Comment
Density rule?
Best regards,
Harald
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
David Racodon
2014-02-24 22:03:49 UTC
Permalink
Hi Harald,

I agree with you.
Feel free to follow and vote for
http://jira.codehaus.org/browse/SONARJAVA-456.

Regards,


*David RACODON | *
*SonarSource **Senior Consultant*
http://sonarsource.com

---------------------------------------------
Sign up to our newsletter
here<http://www.sonarsource.com/company/news/newsletter/>
!
---------------------------------------------
Post by Harald Wellmann
Hi David,
thanks for the pointers. I'm just wondering why every comment above the
packages declaration is considered as a license header. My
package-info.java files typically contain a license header comment (/* ...
*/) followed by a Javadoc comment (/** ... */), followed by the package
declaration.
It should be simple to check whether or not the comment is a Javadoc
comment and count all Javadoc comment lines. Should I create a JIRA ticket
for that?
Best regards,
Harald
Hi Harald,
Post by David Racodon
Every comment line above the packages declaration is considered as
license header by SonarQube. Therefore, these lines are not counted as
comments. See
http://nemo.sonarqube.org/drilldown/measures/48569?metric=comment_lines_density#for example.
See
http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-IgnoreIssuesto deactivate the "Comment Density" rule on these package-info.java files.
Regards,
*David RACODON | *
*SonarSource **Senior Consultant*
http://sonarsource.com
---------------------------------------------
Sign up to our newsletter here<http://www.sonarsource.com/company/news/newsletter/>
!
---------------------------------------------
Post by Harald Wellmann
SonarQube 4.1.1 reports 0 % comment lines in my package-info.java,
although there is a lengthy Javadoc comment.
Is there a workaround, short of deactivating the Insufficient Comment
Density rule?
Best regards,
Harald
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Loading...