mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2024-10-27 20:44:05 +00:00
Qodana integration
This commit is contained in:
parent
e3dd698e1e
commit
be7db8265f
BIN
.github/readme/qodana.png
vendored
Normal file
BIN
.github/readme/qodana.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 196 KiB |
BIN
.github/readme/run-debug-configurations.png
vendored
BIN
.github/readme/run-debug-configurations.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 101 KiB |
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -74,6 +74,10 @@ jobs:
|
||||
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
|
||||
key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }}
|
||||
|
||||
# Run Qodana inspections
|
||||
- name: Qodana - Code Inspection
|
||||
uses: JetBrains/qodana-action@v2.1-eap
|
||||
|
||||
# Run tests
|
||||
- name: Run Tests
|
||||
run: ./gradlew test
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.gradle
|
||||
.idea
|
||||
.qodana
|
||||
build
|
||||
|
26
.run/Run Qodana.run.xml
Normal file
26
.run/Run Qodana.run.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run Qodana" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="env">
|
||||
<map>
|
||||
<entry key="QODANA_SHOW_REPORT" value="true" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="cleanInspections runInspections" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list />
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
35
README.md
35
README.md
@ -34,6 +34,7 @@ In this README, we will highlight the following elements of template-project cre
|
||||
- listeners – project and dynamic plugin lifecycle
|
||||
- services – project-related and application-related services
|
||||
- actions – basic action with shortcut binding
|
||||
- [Qodana integration](#qodana-integration)
|
||||
- [Predefined Run/Debug configurations](#predefined-rundebug-configurations)
|
||||
- [Continuous integration](#continuous-integration) based on GitHub Actions
|
||||
- [Dependencies management](#dependencies-management) with Dependabot
|
||||
@ -159,6 +160,7 @@ A generated IntelliJ Platform Plugin Template repository contains the following
|
||||
├── gradlew *nix Gradle Wrapper binary
|
||||
├── gradlew.bat Windows Gradle Wrapper binary
|
||||
├── LICENSE License, MIT by default
|
||||
├── qodana.yml Qodana configuration file
|
||||
├── README.md README
|
||||
└── settings.gradle.kts Grade project settings
|
||||
```
|
||||
@ -218,6 +220,28 @@ To start with the actual implementation, you may check our [IntelliJ Platform SD
|
||||
For those, who value example codes the most, there are also available [IntelliJ SDK Code Samples][gh:code-samples] and [IntelliJ Platform Explorer][jb:ipe] – a search tool for browsing Extension Points inside existing implementations of open-source IntelliJ Platform plugins.
|
||||
|
||||
|
||||
## Qodana integration
|
||||
|
||||
To increase the project value, the IntelliJ Platform Plugin Template got integrated with [Qodana][docs:qodana], a code quality monitoring platform that allows you to check the condition of your implementation and find any possible problems that may require enhancing.
|
||||
|
||||
Qodana brings into your CI/CD pipelines all the smart features you love in the JetBrains IDEs and generates an HTML report with the actual inspection status.
|
||||
|
||||
Qodana inspections are accessible within the project on two levels:
|
||||
|
||||
- using the [Qodana IntelliJ GitHub Action][docs:qodana-github-action], run automatically within the [Build](.github/workflows/build.yml) workflow,
|
||||
- with the [Gradle Qodana Plugin][gh:gradle-qodana-plugin], so you can use it on the local environment or any CI other than GitHub Actions.
|
||||
|
||||
Qodana inspection is configured with the `qodana { ... }` section in the Gradle build file, and [`qodana.yml`][file:qodana.yml] YAML configuration file.
|
||||
|
||||
> **NOTE:** Qodana requires Docker to be installed and available in your environment.
|
||||
|
||||
To run inspections, you can use a predefined *Run Qodana* configuration, which will provide a full report on `http://localhost:8080`, or invoke the Gradle task directly with the `./gradlew runInspections` command.
|
||||
|
||||
A final report is available in the `./build/reports/inspections/` directory.
|
||||
|
||||
![Qodana][file:qodana.png]
|
||||
|
||||
|
||||
## Predefined Run/Debug configurations
|
||||
|
||||
Within the default project structure, there is a `.run` directory provided containing three predefined *Run/Debug configurations* that expose corresponding Gradle tasks:
|
||||
@ -225,13 +249,13 @@ Within the default project structure, there is a `.run` directory provided conta
|
||||
![Run/Debug configurations][file:run-debug-configurations.png]
|
||||
|
||||
| Configuration name | Description |
|
||||
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Run Plugin | Runs [`:runIde`][gh:gradle-intellij-plugin-running-dsl] Gradle IntelliJ Plugin task. Use the *Debug* icon for plugin debugging. |
|
||||
| Run Tests | Runs [`:test`][gradle-lifecycle-tasks] Gradle task. |
|
||||
| Run Qodana | Runs [`:runInspections`][gh:gradle-qodana-plugin] Gradle Qodana Plugin task. Starts Qodana inspections in a Docker container and serves generated report on `localhost:8080`. |
|
||||
| Run Verifications | Runs [`:runPluginVerifier`][gh:gradle-intellij-plugin-verifier-dsl] Gradle IntelliJ Plugin task to check the plugin compatibility against the specified IntelliJ IDEs. |
|
||||
| Publish Plugin | Runs `signPlugin` and `publishPlugin` Gradle tasks. Check [Environment variables](#environment-variables) section for more details on how to configure it. |
|
||||
|
||||
|
||||
> **TIP:** You can find the logs from the running task in the `idea.log` tab.
|
||||
>
|
||||
> ![Run/Debug configuration logs][file:run-logs.png]
|
||||
@ -273,7 +297,7 @@ Keeping the project in good shape and having all the dependencies up-to-date req
|
||||
|
||||
Dependabot is a bot provided by GitHub for checking the build configuration files and reviewing any outdated or insecure dependencies of yours – in case if any update is available, it creates a new pull request providing [the proper change][gh:dependabot-pr].
|
||||
|
||||
> **Note:** Dependabot doesn't yet support checking of the Gradle Wrapper.
|
||||
> **NOTE:** Dependabot doesn't yet support checking of the Gradle Wrapper.
|
||||
> Check the [Gradle Releases][gradle-releases] page and update your `gradle.properties` file with:
|
||||
> ```properties
|
||||
> gradleVersion = 7.2
|
||||
@ -412,6 +436,8 @@ If the message contains one of the following strings: `[skip ci]`, `[ci skip]`,
|
||||
[docs:release-channel]: https://plugins.jetbrains.com/docs/intellij/deployment.html?from=IJPluginTemplate#specifying-a-release-channel
|
||||
[docs:using-gradle]: https://plugins.jetbrains.com/docs/intellij/gradle-build-system.html?from=IJPluginTemplate
|
||||
[docs:plugin-signing]: https://plugins.jetbrains.com/docs/intellij/plugin-signing.html?from=IJPluginTemplate
|
||||
[docs:qodana]: https://www.jetbrains.com/help/qodana
|
||||
[docs:qodana-github-action]: https://www.jetbrains.com/help/qodana/qodana-intellij-github-action.html
|
||||
|
||||
[file:use-this-template.png]: .github/readme/use-this-template.png
|
||||
[file:draft-release.png]: .github/readme/draft-release.png
|
||||
@ -423,11 +449,14 @@ If the message contains one of the following strings: `[skip ci]`, `[ci skip]`,
|
||||
[file:run-debug-env.png]: .github/readme/run-debug-env.png
|
||||
[file:template_cleanup.yml]: ./.github/workflows/template-cleanup.yml
|
||||
[file:intellij-platform-plugin-template.png]: ./.github/readme/intellij-platform-plugin-template.png
|
||||
[file:qodana.yml]: ./qodana.yml
|
||||
[file:qodana.png]: .github/readme/qodana.png
|
||||
|
||||
[gh:actions]: https://help.github.com/en/actions
|
||||
[gh:dependabot]: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/keeping-your-dependencies-updated-automatically
|
||||
[gh:code-samples]: https://github.com/JetBrains/intellij-sdk-code-samples
|
||||
[gh:gradle-changelog-plugin]: https://github.com/JetBrains/gradle-changelog-plugin
|
||||
[gh:gradle-qodana-plugin]: https://github.com/JetBrains/gradle-qodana-plugin
|
||||
[gh:gradle-intellij-plugin]: https://github.com/JetBrains/gradle-intellij-plugin
|
||||
[gh:gradle-intellij-plugin-running-dsl]: https://github.com/JetBrains/gradle-intellij-plugin#running-dsl
|
||||
[gh:gradle-intellij-plugin-verifier-dsl]: https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
|
||||
|
@ -8,10 +8,12 @@ plugins {
|
||||
id("java")
|
||||
// Kotlin support
|
||||
id("org.jetbrains.kotlin.jvm") version "1.5.30"
|
||||
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
|
||||
// Gradle IntelliJ Plugin
|
||||
id("org.jetbrains.intellij") version "1.1.4"
|
||||
// gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
|
||||
// Gradle Changelog Plugin
|
||||
id("org.jetbrains.changelog") version "1.3.0"
|
||||
// Gradle Qodana Plugin
|
||||
id("org.jetbrains.qodana") version "0.1.12"
|
||||
}
|
||||
|
||||
group = properties("pluginGroup")
|
||||
@ -22,8 +24,7 @@ repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
// Configure gradle-intellij-plugin plugin.
|
||||
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
|
||||
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
|
||||
intellij {
|
||||
pluginName.set(properties("pluginName"))
|
||||
version.set(properties("platformVersion"))
|
||||
@ -35,13 +36,20 @@ intellij {
|
||||
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
|
||||
}
|
||||
|
||||
// Configure gradle-changelog-plugin plugin.
|
||||
// Read more: https://github.com/JetBrains/gradle-changelog-plugin
|
||||
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
|
||||
changelog {
|
||||
version.set(properties("pluginVersion"))
|
||||
groups.set(emptyList())
|
||||
}
|
||||
|
||||
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
|
||||
qodana {
|
||||
cachePath.set(projectDir.resolve(".qodana").canonicalPath)
|
||||
reportPath.set(projectDir.resolve("build/reports/inspections").canonicalPath)
|
||||
saveReport.set(true)
|
||||
showReport.set(System.getenv("QODANA_SHOW_REPORT").toBoolean())
|
||||
}
|
||||
|
||||
tasks {
|
||||
// Set the JVM compatibility versions
|
||||
properties("javaVersion").let {
|
||||
@ -65,7 +73,7 @@ tasks {
|
||||
|
||||
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
|
||||
pluginDescription.set(
|
||||
File(projectDir, "README.md").readText().lines().run {
|
||||
projectDir.resolve("README.md").readText().lines().run {
|
||||
val start = "<!-- Plugin description -->"
|
||||
val end = "<!-- Plugin description end -->"
|
||||
|
||||
|
6
qodana.yml
Normal file
6
qodana.yml
Normal file
@ -0,0 +1,6 @@
|
||||
# Qodana configuration:
|
||||
# https://www.jetbrains.com/help/qodana/qodana-yaml.html
|
||||
|
||||
version: 1.0
|
||||
profile:
|
||||
name: qodana.recommended
|
@ -1,6 +1,5 @@
|
||||
package org.jetbrains.plugins.template
|
||||
|
||||
import com.intellij.AbstractBundle
|
||||
import com.intellij.DynamicBundle
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
@ -15,7 +14,7 @@ object MyBundle : DynamicBundle(BUNDLE) {
|
||||
fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
|
||||
getMessage(key, *params)
|
||||
|
||||
@Suppress("SpreadOperator")
|
||||
@Suppress("SpreadOperator", "unused")
|
||||
@JvmStatic
|
||||
fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
|
||||
getLazyMessage(key, *params)
|
||||
|
Loading…
Reference in New Issue
Block a user