Sonar Lint Rule for Missing java Test class

Please provide

  • Operating system: Windows 11
  • SonarLint plugin version: 8.2.0.68615
  • Programming language you’re coding in: Java
  • Is connected mode used: No
    • Connected to SonarCloud or SonarQube (and which version):

And a thorough description of the problem / question:

We want to enable or enforce the developers to follow Test First Approach or Test Driven Development.

For this I am thinking of writing a Sonar custom rule which highlights the violation when a new Java class is written first and the corresponding Test.java is not yet present.

Could you please guide if there is already a Rule defined for this requirement. Or need to Write our own.

Thanks,
Avinash

Hi,

Welcome to the community!

You would need to write your own rule for this (feel free to post specific programming questions in the Writing rules category). Further, you would need to use SonarQube to run the rule since we restrict what runs in SonarLint to the rules we offer - we’ve learned the hard way that it’s the only way we can ensure a good developer experience.

 
HTH,
Ann