SonarQube : Can not get LOC calculated for the src/test classes

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    sonarqube-8.6.0.39681 server to display Jacoco pertest coverage
  • what are you trying to achieve
    I wish to get the Lines Of Code for my tests classes inside a multimodule maven - Java based project.
  • what have you tried so far to achieve this
    I have set up in parent pom as
    <java.version>1.8</java.version>
    <sonar.language>java</sonar.language>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>

And This is the high level project structure:

parent pom has two modules:
1st child module all classes are in the package : src/main/java
2nd child module all classes are in the package : src/test/java

I can see the LOC for the 1st module with no issues.
But the issue is with the 2nd module, where I do not get the LOC details in the dashboard. This is how I get in the analysis report: It conly counts the child pom lines in that module which is 72.

How to get the Code Lines of count from the second module src/test/java contained class files.

Hi,

Thank you for your post.

Only very few rules are currently activated on test code.

This is however something we may consider in the future on product roadmap. I therefore created an Insight on Product Board.

Regards,

Richard

Thanks @Richard_Mathis Is there a documentation done on the current test code rules, hence please share those.

Also please consider about tests since lots of test automation projects done via Testng/Junit also may need to chk for code quality by Automation Engineers. :slight_smile:
When the rules are enhanced please keep us posted. Thanks.

Hi,

You can find the list of the current rules targetting the tests at Rules explorer

Regards,
Richard

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.