Skip to content

Commit 23bf675

Browse files
authored
CM-38753 - Add support for IDEs 2024.2.*; drop support for IDEs 2021.* and 2022.* (#77)
1 parent 3636076 commit 23bf675

34 files changed

+121
-114
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
uses: actions/setup-java@v3
5151
with:
5252
distribution: zulu
53-
java-version: 11
53+
java-version: 17
5454

5555
- name: Setup Gradle
5656
uses: gradle/[email protected]
@@ -112,7 +112,7 @@ jobs:
112112
# uses: actions/setup-java@v3
113113
# with:
114114
# distribution: zulu
115-
# java-version: 11
115+
# java-version: 17
116116
#
117117
# - name: Setup Gradle
118118
# uses: gradle/[email protected]
@@ -186,7 +186,7 @@ jobs:
186186
uses: actions/setup-java@v3
187187
with:
188188
distribution: zulu
189-
java-version: 11
189+
java-version: 17
190190

191191
- name: Setup Gradle
192192
uses: gradle/[email protected]

CHANGELOG.md

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

55
## [Unreleased]
66

7+
## [2.0.0] - 2024-08-20
8+
9+
- Add support for IDEs 2024.2
10+
- Drop support for IDEs 2021 and 2022
11+
712
## [1.9.5] - 2024-07-30
813

914
- Fix UI tree component loading in new IDE versions
@@ -111,6 +116,8 @@
111116

112117
The first public release of the plugin.
113118

119+
[2.0.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.0.0
120+
114121
[1.9.5]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.9.5
115122

116123
[1.9.4]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.9.4
@@ -155,4 +162,4 @@ The first public release of the plugin.
155162

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

158-
[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v1.9.5...HEAD
165+
[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v2.0.0...HEAD

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ dependencies {
2828
implementation(libs.flexmark)
2929
}
3030

31-
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
31+
// Set the JVM language level used to build the project. We are using Java 17 for 2022.2+.
3232
kotlin {
33-
jvmToolchain(11)
33+
jvmToolchain(17)
3434
}
3535

3636
java {
3737
toolchain {
38-
languageVersion.set(JavaLanguageVersion.of(11))
38+
languageVersion.set(JavaLanguageVersion.of(17))
3939
vendor.set(JvmVendorSpec.AZUL)
4040
}
4141
}

gradle.properties

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

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

1313
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
1414
platformType = IC
15-
# starting from Apple Silicon support + fixes for development on Apple Silicon
16-
# ref: https://youtrack.jetbrains.com/issue/IDEA-260376
17-
platformVersion = 2021.1
15+
# 2021.1 - Apple Silicon support + fixes for development on Apple Silicon
16+
# 2022.3 - minimum version for IntelliJ Platform Gradle Plugin (2.x)
17+
# 2023.1 - allows to fix "com.intellij.diagnostic.PluginException: `ActionUpdateThread.OLD_EDT` is deprecated blabla"
18+
platformVersion = 2023.1
1819

1920
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
2021
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22

gradle/libs.versions.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[versions]
22
# libraries
3-
annotations = "24.0.1"
4-
jackson = "2.15.2"
3+
annotations = "24.1.0"
4+
jackson = "2.17.2"
55
flexmark = "0.64.8"
66

77
# plugins
8-
dokka = "1.9.10"
9-
kotlin = "1.9.20"
10-
changelog = "2.2.0"
11-
gradleIntelliJPlugin = "1.17.1"
8+
dokka = "1.9.20"
9+
kotlin = "2.0.10"
10+
changelog = "2.2.1"
11+
gradleIntelliJPlugin = "1.17.4" # the latest before 2.0 with a lot of breaking changes
1212
kover = "0.7.3"
13-
sentry = "4.9.0"
13+
sentry = "4.11.0"
1414

1515
[libraries]
1616
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }

src/main/kotlin/com/cycode/plugin/annotators/annotationAppliers/IacApplier.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import com.intellij.psi.PsiFile
1212
import java.io.File
1313

1414
class IacApplier(private val scanResults: ScanResultsService) : AnnotationApplierBase() {
15-
private fun validateIacTextRange(textRange: TextRange, psiFile: PsiFile): Boolean {
15+
private fun validateIacTextRange(): Boolean {
1616
// FIXME(MarshalX): for now, I dont see any way to validate the text range for IaC
1717
// small explanation:
1818
// - IaC doesn't provide end positions, so we have to calculate them from the line number (get the last character in the line)
@@ -41,7 +41,7 @@ class IacApplier(private val scanResults: ScanResultsService) : AnnotationApplie
4141
val detectionDetails = detection.detectionDetails
4242
val textRange = TextRange(startOffset, endOffset)
4343

44-
if (!validateTextRange(textRange, psiFile) || !validateIacTextRange(textRange, psiFile)) {
44+
if (!validateTextRange(textRange, psiFile) || !validateIacTextRange()) {
4545
return@forEach
4646
}
4747

src/main/kotlin/com/cycode/plugin/annotators/annotationAppliers/SastApplier.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import com.intellij.openapi.util.TextRange
1111
import com.intellij.psi.PsiFile
1212

1313
class SastApplier(private val scanResults: ScanResultsService) : AnnotationApplierBase() {
14-
private fun validateSastTextRange(textRange: TextRange, psiFile: PsiFile): Boolean {
14+
private fun validateSastTextRange(): Boolean {
1515
// FIXME(MarshalX): for now, I dont see any way to validate the text range for SAST
1616
// small explanation:
1717
// - SAST doesn't provide end positions, so we have to calculate them from the line number (get the last character in the line)
@@ -40,7 +40,7 @@ class SastApplier(private val scanResults: ScanResultsService) : AnnotationAppli
4040
val detectionDetails = detection.detectionDetails
4141
val textRange = TextRange(startOffset, endOffset)
4242

43-
if (!validateTextRange(textRange, psiFile) || !validateSastTextRange(textRange, psiFile)) {
43+
if (!validateTextRange(textRange, psiFile) || !validateSastTextRange()) {
4444
return@forEach
4545
}
4646

src/main/kotlin/com/cycode/plugin/annotators/utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import com.intellij.openapi.util.TextRange
55
import com.intellij.psi.PsiFile
66

77
fun convertSeverity(severity: String): HighlightSeverity {
8-
return when (severity.toLowerCase()) {
8+
return when (severity.lowercase()) {
99
"critical" -> HighlightSeverity.ERROR
1010
"high" -> HighlightSeverity.ERROR
1111
"medium" -> HighlightSeverity.WARNING

src/main/kotlin/com/cycode/plugin/cli/CliWrapper.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.cycode.plugin.cli
33
import com.cycode.plugin.cli.models.CliError
44
import com.cycode.plugin.services.pluginSettings
55
import com.fasterxml.jackson.databind.DeserializationFeature
6+
import com.fasterxml.jackson.databind.ObjectMapper
67
import com.fasterxml.jackson.databind.PropertyNamingStrategies
78
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
89
import com.fasterxml.jackson.module.kotlin.readValue
@@ -29,7 +30,7 @@ class CliOSProcessHandler(commandLine: GeneralCommandLine) : OSProcessHandler(co
2930
class CliWrapper(val executablePath: String, val workDirectory: String? = null) {
3031
val pluginSettings = pluginSettings()
3132

32-
var mapper = jacksonObjectMapper()
33+
var mapper: ObjectMapper = jacksonObjectMapper()
3334
.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
3435
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
3536

src/main/kotlin/com/cycode/plugin/cli/ErrorHandling.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ enum class ErrorCode {
1010
const val MISSING_C_STANDARD_LIBRARY_SEARCH = "GLIBC"
1111

1212
private fun caseInsensitiveSearch(output: String, search: String): Boolean {
13-
return output.toLowerCase().contains(search.toLowerCase())
13+
return output.lowercase().contains(search.lowercase())
1414
}
1515

1616
fun detectErrorCode(output: String): ErrorCode {

src/main/kotlin/com/cycode/plugin/cli/Helpers.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private val INFRA_CONFIGURATION_SCAN_SUPPORTED_FILE_SUFFIXES: List<String> = lis
7070
)
7171

7272
fun isSupportedIacFile(filename: String): Boolean {
73-
val lowercaseFilename = filename.toLowerCase()
73+
val lowercaseFilename = filename.lowercase()
7474
INFRA_CONFIGURATION_SCAN_SUPPORTED_FILE_SUFFIXES.forEach {
7575
if (lowercaseFilename.endsWith(it)) {
7676
return true
@@ -81,7 +81,7 @@ fun isSupportedIacFile(filename: String): Boolean {
8181
}
8282

8383
fun isSupportedPackageFile(filename: String): Boolean {
84-
val lowercaseFilename = filename.toLowerCase()
84+
val lowercaseFilename = filename.lowercase()
8585
SCA_CONFIGURATION_SCAN_SUPPORTED_FILES.forEach {
8686
if (lowercaseFilename.endsWith(it)) {
8787
return true
@@ -92,7 +92,7 @@ fun isSupportedPackageFile(filename: String): Boolean {
9292
}
9393

9494
fun isSupportedLockFile(filename: String): Boolean {
95-
val lowercaseFilename = filename.toLowerCase()
95+
val lowercaseFilename = filename.lowercase()
9696
SCA_CONFIGURATION_SCAN_SUPPORTED_LOCK_FILES.forEach {
9797
if (lowercaseFilename.endsWith(it)) {
9898
return true
@@ -103,6 +103,6 @@ fun isSupportedLockFile(filename: String): Boolean {
103103
}
104104

105105
fun getPackageFileForLockFile(filename: String): String {
106-
val lowercaseFilename = filename.toLowerCase()
106+
val lowercaseFilename = filename.lowercase()
107107
return SCA_CONFIGURATION_SCAN_LOCK_FILE_TO_PACKAGE_FILE.getOrDefault(lowercaseFilename, "package")
108108
}

src/main/kotlin/com/cycode/plugin/components/settingsWindow/SettingsWindow.kt

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import com.cycode.plugin.settings.Settings
66
import com.intellij.openapi.ui.DialogPanel
77
import com.intellij.ui.components.JBCheckBox
88
import com.intellij.ui.components.JBTextField
9-
import com.intellij.ui.layout.panel
9+
import com.intellij.ui.dsl.builder.panel
1010

1111
class SettingsWindow {
1212
private val pluginSettings = pluginSettings()
@@ -24,47 +24,33 @@ class SettingsWindow {
2424

2525
fun getComponent(): DialogPanel {
2626
val contentPanel = panel {
27-
titledRow(CycodeBundle.message("settingsCliSectionTitle")) {
28-
row(label = CycodeBundle.message("settingsCliAutoManagedCheckbox")) {
29-
cell {
30-
cliAutoManagedCheckbox()
31-
}
27+
group(CycodeBundle.message("settingsCliSectionTitle")) {
28+
row(CycodeBundle.message("settingsCliAutoManagedCheckbox")) {
29+
cell(cliAutoManagedCheckbox)
3230
}
33-
row(label = CycodeBundle.message("settingsCliPathLabel")) {
34-
cell {
35-
cliPathTextField()
36-
}
31+
row(CycodeBundle.message("settingsCliPathLabel")) {
32+
cell(cliPathTextField)
3733
}
38-
row(label = CycodeBundle.message("settingsCliAdditionalParamsLabel")) {
39-
cell {
40-
cliAdditionalParamsTextField()
41-
}
34+
row(CycodeBundle.message("settingsCliAdditionalParamsLabel")) {
35+
cell(cliAdditionalParamsTextField)
4236
}
4337
}
44-
titledRow(CycodeBundle.message("settingsOnPremiseSectionTitle")) {
45-
row(label = CycodeBundle.message("settingsCliApiUrlLabel")) {
46-
cell {
47-
cliApiUrlTextField()
48-
}
38+
group(CycodeBundle.message("settingsOnPremiseSectionTitle")) {
39+
row(CycodeBundle.message("settingsCliApiUrlLabel")) {
40+
cell(cliApiUrlTextField)
4941
}
50-
row(label = CycodeBundle.message("settingsCliAppUrlLabel")) {
51-
cell {
52-
cliAppUrlTextField()
53-
}
42+
row(CycodeBundle.message("settingsCliAppUrlLabel")) {
43+
cell(cliAppUrlTextField)
5444
}
5545
}
56-
titledRow(CycodeBundle.message("settingsIdeSectionTitle")) {
57-
row(label = CycodeBundle.message("settingsScanOnSaveCheckbox")) {
58-
cell {
59-
scanOnSaveCheckbox()
60-
}
46+
group(CycodeBundle.message("settingsIdeSectionTitle")) {
47+
row(CycodeBundle.message("settingsScanOnSaveCheckbox")) {
48+
cell(scanOnSaveCheckbox)
6149
}
6250
}
63-
titledRow(CycodeBundle.message("settingsExperimentalSectionTitle")) {
64-
row(label = CycodeBundle.message("settingsScaSyncFlowCheckbox")) {
65-
cell {
66-
scaSyncFlowCheckbox()
67-
}
51+
group(CycodeBundle.message("settingsExperimentalSectionTitle")) {
52+
row(CycodeBundle.message("settingsScaSyncFlowCheckbox")) {
53+
cell(scaSyncFlowCheckbox)
6854
}
6955
}
7056
}

src/main/kotlin/com/cycode/plugin/components/toolWindow/CycodeToolWindowFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private fun replaceToolWindowRightPanel(project: Project, panel: JPanel) {
7070
}
7171

7272
private fun createToolWindowContent(component: JPanel): Content {
73-
return ContentFactory.SERVICE.getInstance().createContent(component, null, false)
73+
return ContentFactory.getInstance().createContent(component, null, false)
7474
}
7575

7676
fun getRightPanelDependingOnState(project: Project): JPanel {

src/main/kotlin/com/cycode/plugin/components/toolWindow/components/cycodeActionToolBar/ActionToolBar.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class CycodeActionToolbar {
1212
val actionGroup = DefaultActionGroup().apply {
1313
add(HomeAction.create(contentTab))
1414
addSeparator()
15-
add(RunAllAction.create(contentTab))
15+
add(RunAllAction.create())
1616
addSeparator()
1717
add(ExpandAllAction.create(contentTab))
1818
add(CollapseAllAction.create(contentTab))
@@ -25,14 +25,13 @@ class CycodeActionToolbar {
2525
addSeparator()
2626
add(ClearAction.create(contentTab))
2727
addSeparator()
28-
add(SettingsAction.create(contentTab))
29-
add(HelpAction.create(contentTab))
28+
add(SettingsAction.create())
29+
add(HelpAction.create())
3030
}
3131

3232
val toolbar = ActionManager.getInstance().createActionToolbar(
3333
CycodeBundle.message("toolbarId"), actionGroup, true
34-
)
35-
toolbar.setTargetComponent(contentTab)
34+
).apply { targetComponent = contentTab }
3635
contentTab.toolbar = toolbar.component
3736

3837
return toolbar

src/main/kotlin/com/cycode/plugin/components/toolWindow/components/cycodeActionToolBar/actions/ClearAction.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.cycode.plugin.components.toolWindow.CycodeContentTab
55
import com.cycode.plugin.services.scanResults
66
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
77
import com.intellij.icons.AllIcons
8+
import com.intellij.openapi.actionSystem.ActionUpdateThread
89
import com.intellij.openapi.actionSystem.AnActionEvent
910
import com.intellij.openapi.project.DumbAwareAction
1011
import java.util.function.Supplier
@@ -17,6 +18,10 @@ class ClearAction(private val contentTab: CycodeContentTab) :
1718
}
1819
}
1920

21+
override fun getActionUpdateThread(): ActionUpdateThread {
22+
return ActionUpdateThread.BGT
23+
}
24+
2025
override fun actionPerformed(e: AnActionEvent) {
2126
val project = e.project ?: return
2227
scanResults(project).clear()

src/main/kotlin/com/cycode/plugin/components/toolWindow/components/cycodeActionToolBar/actions/FilterBySeverityAction.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.cycode.plugin.components.toolWindow.components.cycodeActionToolBar.a
33
import com.cycode.plugin.CycodeBundle
44
import com.cycode.plugin.components.toolWindow.CycodeContentTab
55
import com.cycode.plugin.icons.PluginIcons
6+
import com.intellij.openapi.actionSystem.ActionUpdateThread
67
import com.intellij.openapi.actionSystem.AnActionEvent
78
import com.intellij.openapi.actionSystem.ToggleAction
89
import com.intellij.openapi.project.DumbAware
@@ -28,12 +29,12 @@ private class SeverityFilterState {
2829
private val selectedFilters = mutableMapOf<String, Boolean>()
2930

3031
fun setState(filter: String, selected: Boolean) {
31-
selectedFilters[filter.toLowerCase()] = selected
32+
selectedFilters[filter.lowercase()] = selected
3233
}
3334

3435
fun getState(filter: String): Boolean {
3536
// by default, all filters are selected
36-
return selectedFilters.getOrDefault(filter.toLowerCase(), true)
37+
return selectedFilters.getOrDefault(filter.lowercase(), true)
3738
}
3839

3940
fun exportState(): Map<String, Boolean> {
@@ -53,6 +54,10 @@ class FilterBySeverityAction(private val contentTab: CycodeContentTab, private v
5354
}
5455
}
5556

57+
override fun getActionUpdateThread(): ActionUpdateThread {
58+
return ActionUpdateThread.BGT
59+
}
60+
5661
override fun isSelected(e: AnActionEvent): Boolean {
5762
val project = e.project ?: return false
5863
val stateManager = SeverityFilterManager.INSTANCE.getOrCreateState(project)

0 commit comments

Comments
 (0)