Skip to content

Commit b313d77

Browse files
authored
CM-40433 - Fix missed markdown blocks on violation cards (#79)
1 parent 2dd8c5d commit b313d77

File tree

20 files changed

+153
-24
lines changed

20 files changed

+153
-24
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
## [Unreleased]
66

7+
## [2.0.1] - 2024-09-25
8+
79
- Fix empty IaC scan results on Windows
10+
- Fix missed markdown blocks on violation cards
811

912
## [2.0.0] - 2024-08-20
1013

@@ -118,6 +121,8 @@
118121

119122
The first public release of the plugin.
120123

124+
[2.0.1]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.0.1
125+
121126
[2.0.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.0.0
122127

123128
[1.9.5]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.9.5
@@ -164,4 +169,4 @@ The first public release of the plugin.
164169

165170
[1.0.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.0.0
166171

167-
[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v2.0.0...HEAD
172+
[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v2.0.1...HEAD

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ pluginGroup = com.cycode.plugin
44
pluginName = Cycode
55
pluginRepositoryUrl = https://github.com/cycodehq/intellij-platform-plugin
66
# SemVer format -> https://semver.org
7-
pluginVersion = 2.0.0
7+
pluginVersion = 2.0.1
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
pluginSinceBuild = 231
11-
pluginUntilBuild = 242.*
11+
pluginUntilBuild = 243.*
1212

1313
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
1414
platformType = IC

src/main/kotlin/com/cycode/plugin/cli/models/scanResult/sca/ScaDetectionDetails.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ data class ScaDetectionDetails(
1515
val vulnerabilityDescription: String?,
1616
val vulnerabilityId: String?,
1717
val alert: ScaDetectionDetailsAlert?,
18+
val description: String?,
19+
val remediationGuidelines: String?,
20+
val customRemediationGuidelines: String?,
21+
val policyDisplayName: String?,
1822
) : ScanDetectionDetailsBase {
1923
override fun getFilepath(): String {
2024
return fileName

src/main/kotlin/com/cycode/plugin/components/toolWindow/components/violationCardContentTab/iacViolationCardContentTab/IacViolationCardContentTab.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class IacViolationCardContentTab : CommonViolationCardContentTab() {
2626
headerContentPanel,
2727
summaryPanel,
2828
companyGuidelines,
29-
cycodeGuidelines
29+
cycodeGuidelines,
3030
)
3131
)
3232
}

src/main/kotlin/com/cycode/plugin/components/toolWindow/components/violationCardContentTab/iacViolationCardContentTab/components/companyGuidelines/IacCompanyGuidelines.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class IacCompanyGuidelines : CardHtmlSummary() {
1414

1515
fun getContent(detection: IacDetection): JComponent {
1616
return getContent(
17-
CycodeBundle.message("iacViolationCardCompanyGuidelinesTitle"),
17+
CycodeBundle.message("violationCardCompanyGuidelinesTitle"),
1818
getCustomGuidelines(detection)
1919
)
2020
}

src/main/kotlin/com/cycode/plugin/components/toolWindow/components/violationCardContentTab/iacViolationCardContentTab/components/cycodeGuidelines/IacCycodeGuidelines.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class IacCycodeGuidelines : CardHtmlSummary() {
1414

1515
fun getContent(detection: IacDetection): JComponent {
1616
return getContent(
17-
CycodeBundle.message("iacViolationCardCycodeGuidelinesTitle"),
17+
CycodeBundle.message("violationCardCycodeGuidelinesTitle"),
1818
getCycodeGuidelines(detection)
1919
)
2020
}

src/main/kotlin/com/cycode/plugin/components/toolWindow/components/violationCardContentTab/iacViolationCardContentTab/components/summary/IacSummary.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import javax.swing.JComponent
77

88
class IacSummary : CardSummary() {
99
fun getContent(detection: IacDetection): JComponent {
10-
val title = CycodeBundle.message("iacViolationCardSummaryTitle")
10+
val title = CycodeBundle.message("violationCardSummaryTitle")
1111
val message = detection.detectionDetails.description ?: detection.message
1212

1313
return getContent(title, message)

src/main/kotlin/com/cycode/plugin/components/toolWindow/components/violationCardContentTab/sastViolationCardContentTab/SastViolationCardContentTab.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package com.cycode.plugin.components.toolWindow.components.violationCardContentT
22

33
import com.cycode.plugin.cli.models.scanResult.sast.SastDetection
44
import com.cycode.plugin.components.toolWindow.components.violationCardContentTab.common.CommonViolationCardContentTab
5+
import com.cycode.plugin.components.toolWindow.components.violationCardContentTab.sastViolationCardContentTab.components.companyGuidelines.SastCompanyGuidelines
6+
import com.cycode.plugin.components.toolWindow.components.violationCardContentTab.sastViolationCardContentTab.components.cycodeGuidelines.SastCycodeGuidelines
57
import com.cycode.plugin.components.toolWindow.components.violationCardContentTab.sastViolationCardContentTab.components.header.SastHeader
68
import com.cycode.plugin.components.toolWindow.components.violationCardContentTab.sastViolationCardContentTab.components.shortSummary.SastShortSummary
79
import com.cycode.plugin.components.toolWindow.components.violationCardContentTab.sastViolationCardContentTab.components.summary.SastSummary
@@ -14,13 +16,17 @@ class SastViolationCardContentTab : CommonViolationCardContentTab() {
1416
val shortSummaryPanel = SastShortSummary().getContent(detection)
1517
val headerContentPanel = SastHeader().addContent(detection)
1618
val summaryPanel = SastSummary().getContent(detection)
19+
val companyGuidelines = SastCompanyGuidelines().getContent(detection)
20+
val cycodeGuidelines = SastCycodeGuidelines().getContent(detection)
1721

1822
return getContent(
1923
listOf(
2024
titlePanel,
2125
shortSummaryPanel,
2226
headerContentPanel,
2327
summaryPanel,
28+
companyGuidelines,
29+
cycodeGuidelines,
2430
)
2531
)
2632
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.cycode.plugin.components.toolWindow.components.violationCardContentTab.sastViolationCardContentTab.components.companyGuidelines
2+
3+
import com.cycode.plugin.CycodeBundle
4+
import com.cycode.plugin.cli.models.scanResult.sast.SastDetection
5+
import com.cycode.plugin.components.toolWindow.components.violationCardContentTab.common.htmlSummary.CardHtmlSummary
6+
import com.cycode.plugin.components.toolWindow.components.violationCardContentTab.convertMarkdownToHtml
7+
import javax.swing.JComponent
8+
9+
class SastCompanyGuidelines : CardHtmlSummary() {
10+
private fun getCustomGuidelines(detection: SastDetection): String? {
11+
val descriptionMarkdown = detection.detectionDetails.customRemediationGuidelines ?: return null
12+
return convertMarkdownToHtml(descriptionMarkdown)
13+
}
14+
15+
fun getContent(detection: SastDetection): JComponent {
16+
return getContent(
17+
CycodeBundle.message("violationCardCompanyGuidelinesTitle"),
18+
getCustomGuidelines(detection)
19+
)
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.cycode.plugin.components.toolWindow.components.violationCardContentTab.sastViolationCardContentTab.components.cycodeGuidelines
2+
3+
import com.cycode.plugin.CycodeBundle
4+
import com.cycode.plugin.cli.models.scanResult.sast.SastDetection
5+
import com.cycode.plugin.components.toolWindow.components.violationCardContentTab.common.htmlSummary.CardHtmlSummary
6+
import com.cycode.plugin.components.toolWindow.components.violationCardContentTab.convertMarkdownToHtml
7+
import javax.swing.JComponent
8+
9+
class SastCycodeGuidelines : CardHtmlSummary() {
10+
private fun getCycodeGuidelines(detection: SastDetection): String? {
11+
val descriptionMarkdown = detection.detectionDetails.remediationGuidelines ?: return null
12+
return convertMarkdownToHtml(descriptionMarkdown)
13+
}
14+
15+
fun getContent(detection: SastDetection): JComponent {
16+
return getContent(
17+
CycodeBundle.message("violationCardCycodeGuidelinesTitle"),
18+
getCycodeGuidelines(detection)
19+
)
20+
}
21+
}

0 commit comments

Comments
 (0)