Skip to content

Commit

Permalink
SLCORE-1091 handle rules with only default section
Browse files Browse the repository at this point in the history
  • Loading branch information
sophio-japharidze-sonarsource committed Dec 17, 2024
1 parent 71b5f80 commit 36e755c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ static Either<RuleMonolithicDescriptionDto, RuleSplitDescriptionDto> transformDe

private static RuleMonolithicDescriptionDto transformMonolithicDescription(RuleDetails ruleDetails) {
var htmlSnippets = new ArrayList<String>();
htmlSnippets.add(ruleDetails.getHtmlDescription());
htmlSnippets.add(ruleDetails.getExtendedDescription());
if (!ruleDetails.getDescriptionSectionsByKey().isEmpty()) {
// The rule has only `default` section
htmlSnippets.addAll(ruleDetails.getDescriptionSectionsByKey().get("default").stream().map(RuleDetails.DescriptionSection::getHtmlContent).collect(Collectors.toList()));
} else {
htmlSnippets.add(ruleDetails.getHtmlDescription());
htmlSnippets.add(ruleDetails.getExtendedDescription());
}
htmlSnippets.add(getCleanCodePrinciplesContent(ruleDetails.getCleanCodePrincipleKeys()));
return new RuleMonolithicDescriptionDto(concat(htmlSnippets));
}
Expand Down

0 comments on commit 36e755c

Please sign in to comment.