S2187 reports all ArchUnit tests as empty (Java)

  • versions used (SonarQube Community Edition Version 7.7 (build 23042))
  • The following Archunit class has one test but is flagged as empty by S2187
  • S2187 should not flag tests as empty if they have any field or method annotated with @ArchTest
import static com.tngtech.archunit.library.dependencies.SlicesRuleDefinition.slices;

@RunWith(ArchUnitRunner.class)
@AnalyzeClasses(packages = "com.xyz")
public class ArchitectureTest {
    private static final String PARENT_PACKAGE = "com.xyz";

    @ArchTest
    public static final ArchRule noCycles = slices().matching(PARENT_PACKAGE + ".(**)").should().beFreeOfCycles();
}

Hello,

Thanks for the feedback, rule S2187 is indeed not covering ArchUnit test framework.
I created the following ticket to improve the rule: SONARJAVA-3263

Cheers,
Michael