From 80c72cd394220f55f0816629d770a08d542d39a7 Mon Sep 17 00:00:00 2001 From: Sebastiano Poggi Date: Fri, 22 Aug 2025 12:59:23 +0200 Subject: [PATCH] [JEWEL-987] Fix Detekt issues in ide-plugin module The checks were not being run so a few slipped through. This fixes them and makes sure some basic Detekt form is run on the GitHub CI as well, to avoid repeats. This happened because we can't run detektMain/detektTest as they require the module to compile, but it can't. IDE plugins need to reference released builds of the platform, which are bound not to have the stuff we haven't released yet. closes https://github.com/JetBrains/intellij-community/pull/3196 (cherry picked from commit 90ba2de863423669470f714159e4ccd45b86f196) (cherry picked from commit 8cb3ae62040f619ab6c3bb9517856c21b594b9d2) IJ-MR-173046 GitOrigin-RevId: 02fa358fa896ca9c9e134f02ad129af2aa21f004 --- .github/workflows/jewel-checks.yml | 6 ++--- .../releasessample/ReleasesSampleCompose.kt | 24 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/jewel-checks.yml b/.github/workflows/jewel-checks.yml index c0e149734cb0..c2a162e977b3 100644 --- a/.github/workflows/jewel-checks.yml +++ b/.github/workflows/jewel-checks.yml @@ -47,9 +47,9 @@ jobs: path: '**/build/test-results/test/TEST-*.xml' retention-days: 7 - - name: Run detektMain and detektTest tasks + - name: Run detekt tasks # Run detekt checks for all modules except the IDE plugin sample, as that is bound to have missing APIs issues - run: ./gradlew detektMain detektTest -x :samples:ide-plugin:detektMain -x :samples:ide-plugin:detektTest --continue --no-daemon + run: ./gradlew detekt detektMain detektTest -x :samples:ide-plugin:detektMain -x :samples:ide-plugin:detektTest --continue --no-daemon - name: Run ktfmt and ktlint checks on IDE plugin # We can only use static analysis that doesn't depend on compilation in the IDE plugin @@ -120,4 +120,4 @@ jobs: env: PR_NUMBER: ${{ github.event.pull_request.number }} GH_TOKEN: ${{ github.token }} - run: ./scripts/validate-api-dump-changes.main.kts \ No newline at end of file + run: ./scripts/validate-api-dump-changes.main.kts diff --git a/platform/jewel/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/releasessample/ReleasesSampleCompose.kt b/platform/jewel/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/releasessample/ReleasesSampleCompose.kt index 40208b86bbda..223f2e6a8adb 100644 --- a/platform/jewel/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/releasessample/ReleasesSampleCompose.kt +++ b/platform/jewel/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/releasessample/ReleasesSampleCompose.kt @@ -102,7 +102,7 @@ internal fun ReleasesSampleCompose(project: Project) { } @Composable -private fun LeftColumn(project: Project, modifier: Modifier = Modifier, onSelectedItemChange: (ContentItem?) -> Unit) { +private fun LeftColumn(project: Project, onSelectedItemChange: (ContentItem?) -> Unit, modifier: Modifier = Modifier) { val service = remember(project) { project.service() } val currentContentSource by service.content.collectAsState() @@ -341,7 +341,7 @@ private fun OverflowMenu(currentContentSource: ContentSource<*>, onContentSource } @Composable -private fun RightColumn(selectedItem: ContentItem?, modifier: Modifier) { +private fun RightColumn(selectedItem: ContentItem?, modifier: Modifier = Modifier) { if (selectedItem == null) { Box(modifier, contentAlignment = Alignment.Center) { Text("Nothing to see here", color = JBUI.CurrentTheme.Label.disabledForeground().toComposeColor()) @@ -435,18 +435,22 @@ private fun ItemDetailsText(selectedItem: ContentItem) { @Composable private fun AndroidReleaseDetails(item: ContentItem.AndroidRelease) { - TextWithLabel("Codename:", item.codename ?: "N/A") - TextWithLabel("Version:", item.versionName) - TextWithLabel("API level:", item.apiLevel.toString()) + Column(verticalArrangement = Arrangement.spacedBy(6.dp)) { + TextWithLabel("Codename:", item.codename ?: "N/A") + TextWithLabel("Version:", item.versionName) + TextWithLabel("API level:", item.apiLevel.toString()) + } } @Composable private fun AndroidStudioReleaseDetails(item: ContentItem.AndroidStudio) { - TextWithLabel("Channel:", item.channel.name) - TextWithLabel("Version:", item.versionName) - TextWithLabel("IntelliJ Platform version:", item.platformVersion) - TextWithLabel("IntelliJ Platform build:", item.platformBuild) - TextWithLabel("Full build number:", item.build) + Column(verticalArrangement = Arrangement.spacedBy(6.dp)) { + TextWithLabel("Channel:", item.channel.name) + TextWithLabel("Version:", item.versionName) + TextWithLabel("IntelliJ Platform version:", item.platformVersion) + TextWithLabel("IntelliJ Platform build:", item.platformBuild) + TextWithLabel("Full build number:", item.build) + } } @Composable