Rules don't work

Hello everyone,

I do not understand. I followed the tutorial from here
I followed the whole tutorial to the letter and when I see if the rule created via the tutorial is taken into account well, not at all … however, it is well in sonarQube,
I added the “java-custom-rules-1.0-SNAPSHOT.jar” file as indicated in the tutorial, I created a java project with the error in it, I added the project in the analyzes sonarQube, I have the function with the error which is displayed in the “code” tab of the project, I have created a “quality profile” with the active rule inside …

I think I did everything but it doesn’t work … Can someone help me, please? I am tired…


Welcome to the community!

Since you admit you’re tired, I’m going to start with the silly question. You’ve created a profile. Is that the profile that was used during analysis? You can tell by expanding the project’s “Project Information” slide-out. E.G.:


Hello Ann,

Thank you :slight_smile:

aha that’s it, I am restored.
I will send pictures … they will be clearer than me:

Project Information

The code to test

My Custom Rule Profile

Rules activated (9)

  • Avoid usage of TreeList
  • Avoid using Object annotated with @ Entity as param of @ RequestMapping used in @ Controller context
  • Title of AvoidAnnotation
  • Avoid Brand in Method Names
  • AAA Return type and parameter of a method should not be the same
  • method with same return type as argument
  • Avoid method declarations
  • Security Annotation Mandatory
  • Avoid using SuperClass

There you go, I don’t know what else to do to make it work.
Merci beaucoup d’avoir répondu aussi vite hier. Si j’avais su je serais resté éveillé :slight_smile:


You’ve found the wrong SonarSourcer to message in french. :stuck_out_tongue: :wink:

Your first screenshot (Project Information) makes it pretty clear that your custom rules profile is not assigned to the project – or at least, there’s been no fresh analysis since you assigned the Quality Profile to that project.

Have you assigned that project to your custom quality profile and have you reanalyzed the project since doing so? You should see your custom quality profile name pop up in the project information drawer when you’ve done everything correctly.

Aha Sorry, I’m detected

Hello Collin, thank you very much.

in my console
[WARNING] SCM provider autodetection failed. Please use “sonar.scm.provider” to define SCM of your project, or disable the SCM Sensor in the project settings.

in sonarQube
warning SCM

I don’t understand

Ho, it works.
I uninstalled the Git SCM plugin. And relaunched Sonarqube.
But, I’m not sure that’s the problem …

Thank you for your quickly reply :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.