When I debug, I am fully powered off, but no exceptions are found at the breakpoint, including super. Visitclass (tree);
So I don’t know what’s wrong. I use jdk16. Here’s my POM environment:
<sonarqube.version>8.9.0.43852</sonarqube.version<sonarjava.version>6.15.1.26025</sonarjava.version>
It is not easy to help you without the sources for your check or the logic for your rule, because I cannot tell how far apart they are.
Make sure that you are pointing to the right test file: the debug screenshot you posted looks unrelated from the test class screenshot (the first shows an issue on WeekDayEnumJava and the second points to LimitMethodRows.java).
It would help if you could share:
A description of the rule you are trying to implement
An example of compliant and non-compliant source code
This is the project address I posted on GitHub[sonar-java](https://github.com/lsttong/sonar-java)
Where the path of the package of the code rule is /docs/java-custom-rules-example/src/main/java/org.sonar.samples.java/checks.
The original intention of EnumClassNameCheck’s custom rule file is to find the names of all enum classes and check whether they have the suffix “Enum”.The standard naming method should be TestEnum.
Thank you for your generous reply. @Dorian_Burihabwa
I think the customized rules are actually very simple. The code when I write the rules is also very simple. I think there should be a problem with the process or preconditions. Please help me see that my source code has been released in GitHub
Hey @KevinJin,
Sorry for the late reply. I had a quick look at the code, and it looks to me like the issues in your test code are not properly identified with a // Noncompiliant comment on the same line.
enum Country { // Noncompliant
...
With comments on the problematic lines, the testing harness can verify if issues are raised at the right location (beware of this when reformatting the file).
Hi @Dorian_Burihabwa
I’m sorry to reply to you so late.
When I execute the compilation command “mvn clean install -f pom.xml” according to your suggestion, an error occurs. I intercept the last part of the error content. The Chinese meaning in the blue box in the figure means that the release version 16 is not supported, and the red box means my Maven version and Java version. What’s the problem?
I’m sorry to ask such a stupid question, because I forgot to compile with the version of 16 because of my work a long time ago. Thank you for your reply
hi @Dorian_Burihabwa
After I successfully compiled and put the jar package into the plugins, I still can’t detect the problems I expect in the code. Moreover, when I use the verify() method, the ‘issues’ attribute in his context object has the contents I expect, but the results I expect will not be reported after the process. This result occurs when I use the verifyNoIssues() method.
Does the above problem cause the bug content I want to scan the project with sonarqube to not appear?How can I make the custom rule plug-in play the effect I expect?