Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLUGINAPI-5 deprecate support of markdown for rule descriptions #13

Open
1 task done
froque opened this issue Feb 15, 2023 · 2 comments
Open
1 task done

PLUGINAPI-5 deprecate support of markdown for rule descriptions #13

froque opened this issue Feb 15, 2023 · 2 comments

Comments

@froque
Copy link
Member Author

froque commented Jan 8, 2024

❯ git diff                                                    
diff --git a/src/main/java/com/premiumminds/sonar/postgres/PostgresSqlRulesDefinition.java b/src/main/java/com/premiumminds/sonar/postgres/PostgresSqlRulesDefinition.java
index 422cbe4..0a35c50 100644
--- a/src/main/java/com/premiumminds/sonar/postgres/PostgresSqlRulesDefinition.java
+++ b/src/main/java/com/premiumminds/sonar/postgres/PostgresSqlRulesDefinition.java
@@ -28,8 +28,15 @@ import com.premiumminds.sonar.postgres.visitors.VisitorCheck;
 import org.sonar.api.rule.RuleKey;
 import org.sonar.api.rule.Severity;
 import org.sonar.api.rules.RuleType;
+import org.sonar.api.server.rule.RuleDescriptionSection;
 import org.sonar.api.server.rule.RulesDefinition;
 
+import static org.sonar.api.server.rule.RuleDescriptionSection.RuleDescriptionSectionKeys.ASSESS_THE_PROBLEM_SECTION_KEY;
+import static org.sonar.api.server.rule.RuleDescriptionSection.RuleDescriptionSectionKeys.HOW_TO_FIX_SECTION_KEY;
+import static org.sonar.api.server.rule.RuleDescriptionSection.RuleDescriptionSectionKeys.INTRODUCTION_SECTION_KEY;
+import static org.sonar.api.server.rule.RuleDescriptionSection.RuleDescriptionSectionKeys.RESOURCES_SECTION_KEY;
+import static org.sonar.api.server.rule.RuleDescriptionSection.RuleDescriptionSectionKeys.ROOT_CAUSE_SECTION_KEY;
+
 public class PostgresSqlRulesDefinition implements RulesDefinition {
 
     public static final String REPOSITORY = "postgres-repository";
@@ -73,6 +80,26 @@ public class PostgresSqlRulesDefinition implements RulesDefinition {
         repository.createRule(RULE_PREFER_ROBUST_STMTS.rule())
                 .setName("prefer-robust-stmts rule")
                 .setType(RuleType.BUG)
+                .addDescriptionSection(RuleDescriptionSection.builder()
+                        .sectionKey(INTRODUCTION_SECTION_KEY)
+                        .htmlContent("INTRODUCTION_SECTION_KEY: Generates an issue when Postgres SQL is not valid and fails to parse 2")
+                        .build())
+                .addDescriptionSection(RuleDescriptionSection.builder()
+                        .sectionKey(ROOT_CAUSE_SECTION_KEY)
+                        .htmlContent("ROOT_CAUSE_SECTION_KEY: Generates an issue when Postgres SQL is not valid and fails to parse 2")
+                        .build())
+                .addDescriptionSection(RuleDescriptionSection.builder()
+                        .sectionKey(ASSESS_THE_PROBLEM_SECTION_KEY)
+                        .htmlContent("ASSESS_THE_PROBLEM_SECTION_KEY: Generates an issue when Postgres SQL is not valid and fails to parse 2")
+                        .build())
+                .addDescriptionSection(RuleDescriptionSection.builder()
+                        .sectionKey(HOW_TO_FIX_SECTION_KEY)
+                        .htmlContent("HOW_TO_FIX_SECTION_KEY: Generates an issue when Postgres SQL is not valid and fails to parse 2")
+                        .build())
+                .addDescriptionSection(RuleDescriptionSection.builder()
+                        .sectionKey(RESOURCES_SECTION_KEY)
+                        .htmlContent("RESOURCES_SECTION_KEY: Generates an issue when Postgres SQL is not valid and fails to parse 2")
+                        .build())
                 .setMarkdownDescription(getClass().getResource("prefer-robust-stmts.md"));
 
         repository.createRule(RULE_CONCURRENTLY.rule())

image

@froque
Copy link
Member Author

froque commented Jan 8, 2024

Wait for more plugins to provide better examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant