Pre-SQ7.6: different directories metric value

Hi,

did a first test with SQ7.6 from your server. I get different directories metric values. Bug or feature?

Regards,
Günter

Hi @guwirth

This is expected. In SonarQube 7.6 we have replaced the old “Maven/Java like” filesystem layout by a more modern hierarchy, without modules, but with a hierarchy of folders (instead of having flat package-like folders).

Before 7.6:

moduleA
   |- src/main/java/com/foo/package1/
       |- FileA1.java
   |- src/main/java/com/foo/package1/package11/
       |- FileA11.java
   |- src/main/java/com/foo/package2/
       |- FileA2.java
   |- src/test/java/com/foo/package2/
       |- FileTestA2.java

Starting from 7.6:

moduleA/src/
   |- main/java/com/foo/
       |- package1/
           |- FileA1.java
           |- package11/
               |- FileA11.java
       |- package2
           |- FileA2.java
   |- test/java/com/foo/package2/
       |- FileTestA2.java

This new approach will change the value of the metric “directories” because this metric count the number of directory “nodes” in the SonarQube component tree. This is misleading since I guess most people expect the value to be the number of physical sub-directories. In my example above, pre-7.6 value would be 3, and post 7.6 value will be 5 (another pitfall of this metric is that folders containing test files are not counted).

Hi Henry,

thanks a lot for your explanation. Did I understand the “5” right?

moduleA/src/ (root not counting)
   |- main/java/com/foo/ (+1)
       |- package1/ (+1)
           |- FileA1.java
           |- package11/ (+1)
               |- FileA11.java
       |- package2 (+1)
           |- FileA2.java
   |- test/java/com/foo/package2/ (+1)
       |- FileTestA2.java

or:

moduleA/src/ (+1)
   |- main/java/com/foo/ (+1)
       |- package1/ (+1)
           |- FileA1.java
           |- package11/ (+1)
               |- FileA11.java
       |- package2 (+1)
           |- FileA2.java
   |- test/java/com/foo/package2/ (test not counting)
       |- FileTestA2.java

…and is this counting 1?

   |- main/java/com/foo/ (+1)

Regards,
Günter

This is the second one (tests not counting).