Track FIXME and TODO comments in test code

Hi,

the rules 1134 (Track uses of “FIXME” tags) and 1135 (Track uses of “TODO” tags) seem to ignore test code.

class FooTest {
  @Test
  void testSomething() {
    // ...
    // FIXME this will totally fail in leap years (squid:1134 False Negative) 
    // ...
  }

  @Test
  void testSomethingElse() {
    // ...
    // TODO refactor this (squid:1135 False Negative) 
    // ...
  }
} 

Is this a bug? Or is there a reason why one would want to ignore TODOs and FIXMEs in test code?

Hello @bduderstadt,

Actually, S1134 and S1135 are not activated at all on Test Code, so it’s not a bug. Only a selected list of rules are by default looking only at Test Code. The full list is here if you are interested.

Soon with SonarQube 8.5+, we are going to change that because we consider there is no reason to have a perfect main code and at the same time a very hard to maintain and buggy test code. This is described in this EPIC: SonarQube helps developers to create reliable and maintainable tests.

As part of this effort we already started to provide rules dedicated to test frameworks (JUnit, AssertJ) but also we want to activate more “main” rules on test code. The first batch of activation is described in MMF-2012 where S1134/S1135 are listed.

Thanks
Alex

1 Like