Hello everybody,
I am currently programming a (custom rules) plugin for Sonarqube that should validate documentation of the class. The validation-rule contains of the following points:
- Whether documentation exists
- Validate tags (e.g. “@tag text” must be exists)
doc example:
/**
* This is documentation of Classname
*
* @tag test, test-tag
*/
At @tag, e.g. The keyword “test, test-tag” should be checked if it`s exists and if can be found in a list of keywords. But first, I want to check first if doc is exists.
However, I am stuck with the problem that I can`t found a way to read the documentation(s) of the class. Then I found this: https://github.com/SonarSource/sonar-java/blob/master/java-checks/src/main/java/org/sonar/java/checks/UndocumentedApiCheck.java
With the GitHub link, I have founded the class Javadoc from org.sonar.java.checks.helper and tried to use it in my plugin in the visitClass-method:
public class DocCheck extends BaseTreeVisitor implements JavaFileScanner {
…
@Override
public void visitClass(ClassTree tree) {
Javadoc javadoc = new Javadoc(tree);
if (javadoc.noMainDescription()) {
reportIssue(this.context, this, tree, "no class description");
}
super.visitClass(tree);
}
…
Junit Tests is passed, so I uploaded the Plugin on the Sonarqube-server. But after building and loading of java project that I want to scan, I got the following error:
java.lang.NoClassDefFoundError: org/sonar/java/checks/helpers/Javadoc
Possibly important: Sonarqube Version is 7.9.2.
Can someone help me with this? I hope it was understandable. Thanks in advance.
BR.