Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
bde95ec
Qodana Inspection: Initial import
novotnyr Oct 21, 2025
8165010
Qodana Inspection: Declare dependency on the Kotlin plugin
novotnyr Oct 21, 2025
dbfdddb
Qodana Inspection: Add module to composite build
novotnyr Oct 21, 2025
90fff6a
Qodana Inspection: Add Kotlin inspection
novotnyr Oct 21, 2025
f308316
Qodana Inspection: Add Playground project as a target for verifications
novotnyr Oct 21, 2025
fdcdfc8
Qodana Inspection: Create sub-composite build for Qodana sample
novotnyr Oct 21, 2025
80ef51e
Qodana Inspection: Add global helper tasks for building and staging
novotnyr Oct 21, 2025
1b75f4e
Qodana Inspection: Add READMEs
novotnyr Oct 21, 2025
969150a
code_inspection_qodana/README.md: Cleanup
karollewandowski Oct 27, 2025
642f0da
Qodana Inspection: Fix typos
novotnyr Oct 27, 2025
2fb6822
Qodana Inspection: Use the proper file name for the service descriptor
novotnyr Oct 27, 2025
95bf575
code_inspection_qodana/README.md: Add information about installing Qo…
karollewandowski Oct 27, 2025
8b99b3b
Add .gitignore for qodana-playground
karollewandowski Oct 28, 2025
d67de2f
code_inspections_qodana/README.md: Cleanup
karollewandowski Oct 28, 2025
b4d8c01
Rename qodana-playground -> qodana_playground
karollewandowski Oct 28, 2025
9d6c7b2
Add copyright notices
karollewandowski Oct 28, 2025
fbb4d83
Add code_inspection_qodana/code_inspection to the verification matrix
karollewandowski Oct 28, 2025
2ff2fcf
Merge branch 'main' into codeinspection-qodana
karollewandowski Oct 28, 2025
2c111b1
Simplify code_inspection_qodana/code_inspection setup
karollewandowski Oct 28, 2025
0b62711
Fix code samples verification for code_inspection_qodana/code_inspection
karollewandowski Oct 28, 2025
29dbf70
Fix code samples verification for code_inspection_qodana/code_inspection
karollewandowski Oct 28, 2025
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
4 changes: 3 additions & 1 deletion .github/workflows/code-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
matrix:
plugin:
- action_basics
- code_inspection_qodana/code_inspection
- comparing_string_references_inspection
- conditional_operator_intention
- editor_basics
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:
shell: bash
run: |
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
echo "sanitizedPluginName=$(echo '${{ matrix.plugin }}' | tr '/' '-')" >> $GITHUB_OUTPUT

- name: Run Plugin Verifier
run: |
Expand All @@ -77,7 +79,7 @@ jobs:
if: ${{ always() }}
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.plugin }}-pluginVerifier-result
name: ${{ steps.properties.outputs.sanitizedPluginName }}-pluginVerifier-result
path: ${{ github.workspace }}/code_samples/${{ matrix.plugin }}/build/reports/pluginVerifier

mirror:
Expand Down
4 changes: 3 additions & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules/qodana-playground.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions code_samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ In the following table, you may find all available samples provided in the separ
| Code Sample | Description |
|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Action Basics](./action_basics) | Action and Action Group patterns implementation, adds entries to the Tools menu. |
| [Kotlin Class Name Convention Inspection](./code_inspection_qodana) | Local Inspection Tool, checks Kotlin class name convention. Allows to be run in Qodana |
| [Comparing References Inspection](./comparing_string_references_inspection) | Local Inspection Tool, adds entries to **Settings | Editor | Inspections | Java | Probable Bugs**. |
| [Conditional Operator Intention](./conditional_operator_intention) | Intention action, suggests converting a ternary operator into an `if` block and adds entry to **Settings | Editor | Intentions | SDK Intentions**. |
| [Editor Basics](./editor_basics) | Basic Editor APIs example with editor popup menu with extra actions. |
Expand Down
2 changes: 2 additions & 0 deletions code_samples/_gradleCompositeBuild/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
org.gradle.jvmargs=-Xmx1024m
1 change: 1 addition & 0 deletions code_samples/_gradleCompositeBuild/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
rootProject.name = "SDK Code Samples"

includeBuild("../action_basics")
includeBuild("../code_inspection_qodana")
includeBuild("../comparing_string_references_inspection")
includeBuild("../conditional_operator_intention")
includeBuild("../editor_basics")
Expand Down
9 changes: 9 additions & 0 deletions code_samples/code_inspection_qodana/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

5 changes: 5 additions & 0 deletions code_samples/code_inspection_qodana/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
44 changes: 44 additions & 0 deletions code_samples/code_inspection_qodana/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# IntelliJ SDK Code Inspection Sample for Qodana

**IntelliJ SDK Code Inspection Sample for Qodana** contains a code inspection sample for IntelliJ Platform plugins.

A single rule is established: every class in the `service` packages must have a `Service` suffix.

## Subprojects

- `code_inspection` - a standalone IntelliJ Platform plugin with this inspection
- `qodana_playground` - a sample project which is validated by Qodana and the custom plugin

## Building and Running

1. Build the IntelliJ Platform plugin and copy it into the custom plugin directory in the Qodana playground project:

```
./gradlew stagePluginForQodana
```

This will build a plugin JAR and copy it into the `qodana_playground/.qodana` directory.

2. Run Qodana from the `qodana_playground` directory with the custom plugin installed.

> This step requires installing [Qodana](https://www.jetbrains.com/help/qodana/quick-start.html#quickstart-run-using-cli) and [Docker](https://www.docker.com/get-started/) before running.

```
cd qodana_playground
qodana scan --clear-cache -v $(echo $PWD/.qodana/*.jar):/opt/idea/custom-plugins/codeinspection.jar
```

3. See the Qodana report in the browser.

## Building and Running in the IDE

1. Build the IntelliJ Platform plugin.

```
./gradlew buildPlugin
```

2. Install the `build/code_inspection-<version>.zip` plugin into JetBrains IDE manually.
3. Make sure that the Qodana plugin is installed and enabled in the JetBrains IDE.
4. Run the **Tools | Qodana | Try Code Analysis** action.
5. See the Qodana reports in the **Qodana** tool window in the IDE.
26 changes: 26 additions & 0 deletions code_samples/code_inspection_qodana/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.

val codeInspectionPlugin = "code_inspection"

tasks.register<Copy>("stagePluginForQodana") {
val qodanaDir = gradle.includedBuild("qodana_playground").projectDir.resolve(".qodana")
dependsOn(gradle.includedBuild(codeInspectionPlugin).task(":buildPlugin"))
from(gradle.includedBuild(codeInspectionPlugin)
.projectDir.resolve("build/libs"))
include("$codeInspectionPlugin-*.jar")
exclude("$codeInspectionPlugin-*-base.jar")
exclude("$codeInspectionPlugin-*-instrumented.jar")
exclude("$codeInspectionPlugin-*-searchableOptions.jar")
into(qodanaDir)
}

tasks.register<Copy>("buildPlugin") {
group = "build"
description = "Builds the Code Inspection plugin"

val plugin = gradle.includedBuild(codeInspectionPlugin)
dependsOn(plugin.task(":buildPlugin"))
from(plugin.projectDir.resolve("build/distributions"))
include("$codeInspectionPlugin-*.zip")
into("build")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
.gradle
.idea
.intellijPlatform
.kotlin
.qodana
build
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Plugin" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="IDE logs" path="$PROJECT_DIR$/build/idea-sandbox/*/log/idea.log" show_all="true" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIde" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- Keep a Changelog guide -> https://keepachangelog.com -->

# SDK: Comparing References Inspection Sample

## [Unreleased]

### Added

- Initial release
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType.IntellijIdea
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType.IntellijIdeaCommunity
import org.jetbrains.intellij.platform.gradle.models.ProductRelease.Channel.RELEASE

plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "2.0.21"
id("org.jetbrains.intellij.platform") version "2.10.2"
id("org.jetbrains.qodana") version "2025.1.1"
}

group = "org.intellij.sdk"
version = "2.0.0"

repositories {
mavenCentral()

intellijPlatform {
defaultRepositories()
}
}

dependencies {
intellijPlatform {
intellijIdeaCommunity("2024.3.6")
bundledPlugin("org.jetbrains.kotlin")
}
}

intellijPlatform {
buildSearchableOptions = false

pluginConfiguration {
ideaVersion {
sinceBuild = "243"
}
}
pluginVerification {
ides {
// since 253, IntelliJ IDEA Community and Ultimate have been merged into IntelliJ IDEA
select {
types = listOf(IntellijIdeaCommunity)
untilBuild = "252.*"
}
select {
types = listOf(IntellijIdea)
sinceBuild = "253"
channels = listOf(RELEASE)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.

# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false

# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache = true

# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching = true
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading