File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
codenarc-converter/src/main/java/org/sonar/plugins/groovy/codenarc/parser/markdown Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ public class RuleSetVisitor extends AbstractVisitor {
4141
4242 private RuleSet ruleset ;
4343 private final List <RuleDescription > rules = new ArrayList <>();
44+ private static final String ECOCODE_RULE_PREFIX = "EC" ;
45+ private static final String ECOCODE_RULE_PACKAGE = "org.codenarc.rule.ecocode." ;
4446
4547 public RuleSetVisitor (RuleRegistry registry , HtmlRenderer htmlRenderer , TextContentRenderer textContentRenderer ) {
4648 this .registry = registry ;
@@ -84,7 +86,12 @@ private boolean isRuleDescriptionSection(Heading heading) {
8486 Node header = heading .getFirstChild ();
8587 if (header .getClass ().isAssignableFrom (Text .class )) {
8688 Text t = (Text ) header ;
87- return registry .getRuleClass (t .getLiteral ().split (" " )[0 ]) != null ;
89+ String ruleClassName = t .getLiteral ().split (" " )[0 ];
90+ if (ruleClassName .startsWith (ECOCODE_RULE_PREFIX )) {
91+ // ecoCode rules does not have their package in the "class" entry
92+ ruleClassName = ECOCODE_RULE_PACKAGE + ruleClassName .toString ();
93+ }
94+ return registry .getRuleClass (ruleClassName ) != null ;
8895 }
8996 }
9097 return false ;
You can’t perform that action at this time.
0 commit comments