Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2.9.0
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
# uses: actions/setup-java@v3
# with:
# distribution: zulu
# java-version: 11
# java-version: 17
#
# - name: Setup Gradle
# uses: gradle/gradle-build-action@v2.9.0
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2.9.0
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

## [Unreleased]

## [2.0.0] - 2024-08-20

- Add support for IDEs 2024.2
- Drop support for IDEs 2021 and 2022

## [1.9.5] - 2024-07-30

- Fix UI tree component loading in new IDE versions
Expand Down Expand Up @@ -111,6 +116,8 @@

The first public release of the plugin.

[2.0.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.0.0

[1.9.5]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.9.5

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

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

[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v1.9.5...HEAD
[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v2.0.0...HEAD
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ dependencies {
implementation(libs.flexmark)
}

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

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.AZUL)
}
}
Expand Down
13 changes: 7 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ pluginGroup = com.cycode.plugin
pluginName = Cycode
pluginRepositoryUrl = https://github.com/cycodehq/intellij-platform-plugin
# SemVer format -> https://semver.org
pluginVersion = 1.9.5
pluginVersion = 2.0.0

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

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

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
Expand Down
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[versions]
# libraries
annotations = "24.0.1"
jackson = "2.15.2"
annotations = "24.1.0"
jackson = "2.17.2"
flexmark = "0.64.8"

# plugins
dokka = "1.9.10"
kotlin = "1.9.20"
changelog = "2.2.0"
gradleIntelliJPlugin = "1.17.1"
dokka = "1.9.20"
kotlin = "2.0.10"
changelog = "2.2.1"
gradleIntelliJPlugin = "1.17.4" # the latest before 2.0 with a lot of breaking changes
kover = "0.7.3"
sentry = "4.9.0"
sentry = "4.11.0"

[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.intellij.psi.PsiFile
import java.io.File

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

if (!validateTextRange(textRange, psiFile) || !validateIacTextRange(textRange, psiFile)) {
if (!validateTextRange(textRange, psiFile) || !validateIacTextRange()) {
return@forEach
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiFile

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

if (!validateTextRange(textRange, psiFile) || !validateSastTextRange(textRange, psiFile)) {
if (!validateTextRange(textRange, psiFile) || !validateSastTextRange()) {
return@forEach
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/cycode/plugin/annotators/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiFile

fun convertSeverity(severity: String): HighlightSeverity {
return when (severity.toLowerCase()) {
return when (severity.lowercase()) {
"critical" -> HighlightSeverity.ERROR
"high" -> HighlightSeverity.ERROR
"medium" -> HighlightSeverity.WARNING
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/com/cycode/plugin/cli/CliWrapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.cycode.plugin.cli
import com.cycode.plugin.cli.models.CliError
import com.cycode.plugin.services.pluginSettings
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
Expand All @@ -29,7 +30,7 @@ class CliOSProcessHandler(commandLine: GeneralCommandLine) : OSProcessHandler(co
class CliWrapper(val executablePath: String, val workDirectory: String? = null) {
val pluginSettings = pluginSettings()

var mapper = jacksonObjectMapper()
var mapper: ObjectMapper = jacksonObjectMapper()
.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/cycode/plugin/cli/ErrorHandling.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum class ErrorCode {
const val MISSING_C_STANDARD_LIBRARY_SEARCH = "GLIBC"

private fun caseInsensitiveSearch(output: String, search: String): Boolean {
return output.toLowerCase().contains(search.toLowerCase())
return output.lowercase().contains(search.lowercase())
}

fun detectErrorCode(output: String): ErrorCode {
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/com/cycode/plugin/cli/Helpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private val INFRA_CONFIGURATION_SCAN_SUPPORTED_FILE_SUFFIXES: List<String> = lis
)

fun isSupportedIacFile(filename: String): Boolean {
val lowercaseFilename = filename.toLowerCase()
val lowercaseFilename = filename.lowercase()
INFRA_CONFIGURATION_SCAN_SUPPORTED_FILE_SUFFIXES.forEach {
if (lowercaseFilename.endsWith(it)) {
return true
Expand All @@ -81,7 +81,7 @@ fun isSupportedIacFile(filename: String): Boolean {
}

fun isSupportedPackageFile(filename: String): Boolean {
val lowercaseFilename = filename.toLowerCase()
val lowercaseFilename = filename.lowercase()
SCA_CONFIGURATION_SCAN_SUPPORTED_FILES.forEach {
if (lowercaseFilename.endsWith(it)) {
return true
Expand All @@ -92,7 +92,7 @@ fun isSupportedPackageFile(filename: String): Boolean {
}

fun isSupportedLockFile(filename: String): Boolean {
val lowercaseFilename = filename.toLowerCase()
val lowercaseFilename = filename.lowercase()
SCA_CONFIGURATION_SCAN_SUPPORTED_LOCK_FILES.forEach {
if (lowercaseFilename.endsWith(it)) {
return true
Expand All @@ -103,6 +103,6 @@ fun isSupportedLockFile(filename: String): Boolean {
}

fun getPackageFileForLockFile(filename: String): String {
val lowercaseFilename = filename.toLowerCase()
val lowercaseFilename = filename.lowercase()
return SCA_CONFIGURATION_SCAN_LOCK_FILE_TO_PACKAGE_FILE.getOrDefault(lowercaseFilename, "package")
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.cycode.plugin.settings.Settings
import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.components.JBCheckBox
import com.intellij.ui.components.JBTextField
import com.intellij.ui.layout.panel
import com.intellij.ui.dsl.builder.panel

class SettingsWindow {
private val pluginSettings = pluginSettings()
Expand All @@ -24,47 +24,33 @@ class SettingsWindow {

fun getComponent(): DialogPanel {
val contentPanel = panel {
titledRow(CycodeBundle.message("settingsCliSectionTitle")) {
row(label = CycodeBundle.message("settingsCliAutoManagedCheckbox")) {
cell {
cliAutoManagedCheckbox()
}
group(CycodeBundle.message("settingsCliSectionTitle")) {
row(CycodeBundle.message("settingsCliAutoManagedCheckbox")) {
cell(cliAutoManagedCheckbox)
}
row(label = CycodeBundle.message("settingsCliPathLabel")) {
cell {
cliPathTextField()
}
row(CycodeBundle.message("settingsCliPathLabel")) {
cell(cliPathTextField)
}
row(label = CycodeBundle.message("settingsCliAdditionalParamsLabel")) {
cell {
cliAdditionalParamsTextField()
}
row(CycodeBundle.message("settingsCliAdditionalParamsLabel")) {
cell(cliAdditionalParamsTextField)
}
}
titledRow(CycodeBundle.message("settingsOnPremiseSectionTitle")) {
row(label = CycodeBundle.message("settingsCliApiUrlLabel")) {
cell {
cliApiUrlTextField()
}
group(CycodeBundle.message("settingsOnPremiseSectionTitle")) {
row(CycodeBundle.message("settingsCliApiUrlLabel")) {
cell(cliApiUrlTextField)
}
row(label = CycodeBundle.message("settingsCliAppUrlLabel")) {
cell {
cliAppUrlTextField()
}
row(CycodeBundle.message("settingsCliAppUrlLabel")) {
cell(cliAppUrlTextField)
}
}
titledRow(CycodeBundle.message("settingsIdeSectionTitle")) {
row(label = CycodeBundle.message("settingsScanOnSaveCheckbox")) {
cell {
scanOnSaveCheckbox()
}
group(CycodeBundle.message("settingsIdeSectionTitle")) {
row(CycodeBundle.message("settingsScanOnSaveCheckbox")) {
cell(scanOnSaveCheckbox)
}
}
titledRow(CycodeBundle.message("settingsExperimentalSectionTitle")) {
row(label = CycodeBundle.message("settingsScaSyncFlowCheckbox")) {
cell {
scaSyncFlowCheckbox()
}
group(CycodeBundle.message("settingsExperimentalSectionTitle")) {
row(CycodeBundle.message("settingsScaSyncFlowCheckbox")) {
cell(scaSyncFlowCheckbox)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private fun replaceToolWindowRightPanel(project: Project, panel: JPanel) {
}

private fun createToolWindowContent(component: JPanel): Content {
return ContentFactory.SERVICE.getInstance().createContent(component, null, false)
return ContentFactory.getInstance().createContent(component, null, false)
}

fun getRightPanelDependingOnState(project: Project): JPanel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CycodeActionToolbar {
val actionGroup = DefaultActionGroup().apply {
add(HomeAction.create(contentTab))
addSeparator()
add(RunAllAction.create(contentTab))
add(RunAllAction.create())
addSeparator()
add(ExpandAllAction.create(contentTab))
add(CollapseAllAction.create(contentTab))
Expand All @@ -25,14 +25,13 @@ class CycodeActionToolbar {
addSeparator()
add(ClearAction.create(contentTab))
addSeparator()
add(SettingsAction.create(contentTab))
add(HelpAction.create(contentTab))
add(SettingsAction.create())
add(HelpAction.create())
}

val toolbar = ActionManager.getInstance().createActionToolbar(
CycodeBundle.message("toolbarId"), actionGroup, true
)
toolbar.setTargetComponent(contentTab)
).apply { targetComponent = contentTab }
contentTab.toolbar = toolbar.component

return toolbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.cycode.plugin.components.toolWindow.CycodeContentTab
import com.cycode.plugin.services.scanResults
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import java.util.function.Supplier
Expand All @@ -17,6 +18,10 @@ class ClearAction(private val contentTab: CycodeContentTab) :
}
}

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}

override fun actionPerformed(e: AnActionEvent) {
val project = e.project ?: return
scanResults(project).clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.cycode.plugin.components.toolWindow.components.cycodeActionToolBar.a
import com.cycode.plugin.CycodeBundle
import com.cycode.plugin.components.toolWindow.CycodeContentTab
import com.cycode.plugin.icons.PluginIcons
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.ToggleAction
import com.intellij.openapi.project.DumbAware
Expand All @@ -28,12 +29,12 @@ private class SeverityFilterState {
private val selectedFilters = mutableMapOf<String, Boolean>()

fun setState(filter: String, selected: Boolean) {
selectedFilters[filter.toLowerCase()] = selected
selectedFilters[filter.lowercase()] = selected
}

fun getState(filter: String): Boolean {
// by default, all filters are selected
return selectedFilters.getOrDefault(filter.toLowerCase(), true)
return selectedFilters.getOrDefault(filter.lowercase(), true)
}

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

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}

override fun isSelected(e: AnActionEvent): Boolean {
val project = e.project ?: return false
val stateManager = SeverityFilterManager.INSTANCE.getOrCreateState(project)
Expand Down
Loading