]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20547 Add conditional check CC category for security hotspot
authorstanislavh <stanislav.honcharov@sonarsource.com>
Mon, 9 Oct 2023 12:49:53 +0000 (14:49 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 10 Oct 2023 20:02:45 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx
server/sonar-web/src/main/js/helpers/testMocks.ts

index 800733aa422a018e1a7cfaef66d25d94f6881315..80abc67bffdd1172acef44281199e6d34a9c3d3e 100644 (file)
@@ -233,16 +233,22 @@ function RuleCell({ rule, severity }: Readonly<{ rule: RuleCompare; severity?: s
       <Link className="sw-ml-1" to={getRulesUrl({ rule_key: rule.key, open: rule.key })}>
         {rule.name}
       </Link>
-      <ul className="sw-mt-3 sw-flex sw-items-center">
-        <li>
-          <CleanCodeAttributePill cleanCodeAttributeCategory={rule.cleanCodeAttributeCategory} />
-        </li>
-        {rule.impacts.map(({ severity, softwareQuality }) => (
-          <li key={softwareQuality} className="sw-ml-2">
-            <SoftwareImpactPill type="rule" quality={softwareQuality} severity={severity} />
-          </li>
-        ))}
-      </ul>
+      {(rule.cleanCodeAttributeCategory || rule.impacts.length > 0) && (
+        <ul className="sw-mt-3 sw-flex sw-items-center">
+          {rule.cleanCodeAttributeCategory && (
+            <li>
+              <CleanCodeAttributePill
+                cleanCodeAttributeCategory={rule.cleanCodeAttributeCategory}
+              />
+            </li>
+          )}
+          {rule.impacts.map(({ severity, softwareQuality }) => (
+            <li key={softwareQuality} className="sw-ml-2">
+              <SoftwareImpactPill type="rule" quality={softwareQuality} severity={severity} />
+            </li>
+          ))}
+        </ul>
+      )}
     </div>
   );
 }
index 1b593839bddf4767ea35b9dc86f908bbd3ac64b0..53fc466a14a8af0293d28011969df74f73957bb9 100644 (file)
@@ -505,13 +505,7 @@ export function mockCompareResult(overrides: Partial<CompareResponse> = {}): Com
     ],
     modified: [
       {
-        cleanCodeAttributeCategory: CleanCodeAttributeCategory.Consistent,
-        impacts: [
-          {
-            softwareQuality: SoftwareQuality.Maintainability,
-            severity: SoftwareImpactSeverity.Low,
-          },
-        ],
+        impacts: [],
         key: 'java:S1698',
         name: '== and != should not be used when equals is overridden',
         left: { params: {}, severity: 'MINOR' },