Problem with : Test classes should comply with a naming convention regex

Hey all,
I have problem with the code coverage of me project.
The thing is that the regex " ^((Test|IT)[a-zA-Z0-9]+|[A-Z][a-zA-Z0-9]*(Test|IT|TestCase|ITCase))$"
for class naming convention doesnt recognise my test classes (ex:OrderServiceIT.java).
It works if I have ‘Test’ at the end of the file.
Can someone can have idea what is the problem, i dont want to reneame all the IT test classes in order to resolve this problem.

Please propose some solution.

Thanks

Hello @Riste_L,
This is strange, because your class name actually matches the regular expression of the rule.
I used the Online regex tester
And tried
Regular Expression: ^((Test|IT)[a-zA-Z0-9]+|[A-Z][a-zA-Z0-9]*(Test|IT|TestCase|ITCase))$
Test String: OrderServiceIT

Is your example class name correct?

On the other hand: The rule is a “Code Smell” ranked as “Minor” - the least important issue you can have in SonarQube :slight_smile: . The rule is also not in the default quality profiles.
So you seem to have very strict coding rules in your team. Think about deactivating the rule and have some relief for your Developers.

Hello Matthias,

Yes that is the correct name of the class. I have also checked that the name matches the regular expression , so that is why it looks very strange to me.

Indeed i will try to deactivate this rule, I am new to sonarCloud and I also need to do some investigation on that part(configuration settings)

Thanks a lot for the comment once more

Hi @Riste_L and welcome to the community !

Can you tell us where does this regex comes from ? Which kind of code are you analyzing ? And with which scanner ?

Thanks.
Mickaël

The RegEx comes from the documentation of the rule that was violated on @Riste_L’s code:
java:S3577

Thanks. Someone from our Languages team will hand over this thread to help you.

Hi guys, this class name is not appropriate according to the Regular Expression - TC111_Verify… (also TC111_VerifyTest) this relates to underscore