// Filter by clean code category
await user.click(ui.facetItem('issue.clean_code_attribute_category.INTENTIONAL').get());
- expect(ui.getAllRuleListItems()).toHaveLength(10);
+ expect(ui.getAllRuleListItems()).toHaveLength(9);
// Filter by software quality
await user.click(ui.facetItem('software_quality.MAINTAINABILITY').get());
- expect(ui.getAllRuleListItems()).toHaveLength(10);
+ expect(ui.getAllRuleListItems()).toHaveLength(9);
// Filter by severity
await user.click(ui.severetiesFacet.get());
await user.click(ui.facetItem(/severity.HIGH/).get());
- expect(ui.getAllRuleListItems()).toHaveLength(9);
+ expect(ui.getAllRuleListItems()).toHaveLength(8);
});
it('filter by standards', async () => {
// Check params data
expect(screen.getByText('html description for key 1')).toBeInTheDocument();
expect(screen.getByText('default value for key 2')).toBeInTheDocument();
+ expect(ui.softwareQualitiesSection.get()).toBeInTheDocument();
+ expect(ui.cleanCodeAttributeSection.get()).toBeInTheDocument();
});
it('shows external rule', async () => {
await ui.detailsloaded();
expect(ui.ruleTitle('Hot hotspot').get()).toBeInTheDocument();
expect(ui.introTitle.get()).toBeInTheDocument();
+ expect(ui.softwareQualitiesSection.query()).not.toBeInTheDocument();
+ expect(ui.cleanCodeAttributeSection.query()).not.toBeInTheDocument();
// Shows correct tabs
[ui.whatRiskTab, ui.assessTab, ui.moreInfoTab].forEach((tab) => {
}
export default function RuleDetailsHeaderSide({ ruleDetails }: Readonly<Props>) {
+ const hasCleanCodeAttribute =
+ ruleDetails.cleanCodeAttributeCategory && ruleDetails.cleanCodeAttribute;
+ const hasSoftwareImpact = ruleDetails.impacts.length > 0;
+
+ if (!hasCleanCodeAttribute && !hasSoftwareImpact) {
+ return null;
+ }
+
return (
<StyledSection className="sw-flex sw-flex-col sw-pl-4 sw-gap-6 sw-max-w-[250px]">
{ruleDetails.cleanCodeAttributeCategory && ruleDetails.cleanCodeAttribute && (
</RuleHeaderInfo>
)}
- <RuleHeaderInfo title={translate('coding_rules.software_qualities.label')}>
- <SoftwareImpactPillList
- className="sw-flex-wrap"
- softwareImpacts={ruleDetails.impacts}
- type="rule"
- />
- </RuleHeaderInfo>
+ {hasSoftwareImpact && (
+ <RuleHeaderInfo title={translate('coding_rules.software_qualities.label')}>
+ <SoftwareImpactPillList
+ className="sw-flex-wrap"
+ softwareImpacts={ruleDetails.impacts}
+ type="rule"
+ />
+ </RuleHeaderInfo>
+ )}
</StyledSection>
);
}
createButton: byRole('button', { name: 'create' }),
reactivateButton: byRole('button', { name: 'coding_rules.reactivate' }),
deleteButton: byRole('button', { name: 'delete' }),
+ softwareQualitiesSection: byText('coding_rules.software_qualities.label'),
+ cleanCodeAttributeSection: byText('coding_rules.cct_attribute.label'),
};
export function getPageObjects() {