Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 1.0.5 for PhpStorm 2023.3 #7

Merged
merged 5 commits into from
Feb 27, 2024
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
49 changes: 43 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@ on:

jobs:

# Prepare environment and build the plugin
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/[email protected]

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
Expand Down Expand Up @@ -51,10 +56,42 @@ jobs:

./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier

# Run tests
- name: Run Tests
run: ./gradlew check
# Build plugin
- name: Build plugin
run: ./gradlew buildPlugin

# Run plugin structure verification along with IntelliJ Plugin Verifier
verify:
name: Verify plugin
needs: [ build ]
runs-on: ubuntu-latest
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}

# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: pluginVerifier-result
path: ${{ github.workspace }}/build/reports/pluginVerifier
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

## [Unreleased]

## [1.0.4] - 2023-08-21
## [1.0.5] - 2024.02.12

- adapt code for 2023.3

## [1.0.4] - 2023.08.21

- adapt code for 2023.2

## [1.0.3] - 2023-08-14
## [1.0.3] - 2023.08.14

- adapt code for 2023.1

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# <img src="src/main/resources/META-INF/pluginIcon.svg"> NoVerify plugin for PhpStorm

[![Build](https://github.com/VKCOM/noverify-phpstorm/workflows/Build/badge.svg)](https://github.com/VKCOM/noverify-phpstorm/workflows/Build/badge.svg)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)
[![Total Downloads](https://img.shields.io/jetbrains/plugin/d/19465)](https://plugins.jetbrains.com/plugin/19465-noverify-support)
[![Latest Version](https://img.shields.io/jetbrains/plugin/v/19465)](https://plugins.jetbrains.com/plugin/19465-noverify-support)
[![Telegram chat](https://img.shields.io/badge/chat-join-brightgreen?logo=telegram)](https://t.me/noverify_linter)

# <img src="src/main/resources/META-INF/pluginIcon.svg"> NoVerify plugin for PhpStorm

## About

This plugin adds dedicated functionality for [NoVerify](https://github.com/VKCOM/noverify) static analysis to [PhpStorm](https://www.jetbrains.com/phpstorm/).
Expand Down
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ repositories {

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
jvmToolchain(17)
@Suppress("UnstableApiUsage")
jvmToolchain {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.JETBRAINS
}
}

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
Expand All @@ -43,10 +47,6 @@ changelog {
}

tasks {
buildSearchableOptions {
enabled = false
}

wrapper {
gradleVersion = properties("gradleVersion").get()
}
Expand Down
15 changes: 9 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ pluginName = NoVerify Support
pluginRepositoryUrl = https://github.com/VKCOM/noverify-phpstorm

# SemVer format -> https://semver.org
pluginVersion = 1.0.4
pluginVersion = 1.0.5

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

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IU
platformVersion = 2023.2
platformVersion = 2023.3

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
# PHP Plugin - https://plugins.jetbrains.com/plugin/6610-php/versions
# PHP Remote Interpreter - https://plugins.jetbrains.com/plugin/7511-php-remote-interpreter
platformPlugins = com.jetbrains.php:232.8660.205, org.jetbrains.plugins.phpstorm-remote-interpreter:232.8660.142
platformPlugins = com.jetbrains.php:233.11799.232, org.jetbrains.plugins.phpstorm-remote-interpreter:233.11799.172

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.3
gradleVersion = 8.5

# 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
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# libraries

# plugins
kotlin = "1.9.0"
changelog = "2.1.2"
gradleIntelliJPlugin = "1.15.0"
kotlin = "1.9.21"
changelog = "2.2.0"
gradleIntelliJPlugin = "1.16.1"

[libraries]

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.6.0"
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

rootProject.name = "phpstorm-noverify-plugin"
4 changes: 0 additions & 4 deletions src/main/kotlin/com/vk/noverify/NoVerifyComposerConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import com.vk.noverify.NoVerifyOpenSettingsProvider.Companion.NOVERIFY_OPEN_SETT

class NoVerifyComposerConfig :
QualityToolsComposerConfig<NoVerifyConfiguration, NoVerifyValidationInspection>(PACKAGE, RELATIVE_PATH) {
override fun getQualityToolsInspectionSettings(): ComposerLogMessageBuilder.Settings? {
return null
}

override fun getQualityInspectionShortName(): String {
return NoVerifyQualityToolType.INSTANCE.inspectionId
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.jetbrains.php.PhpBundle
import com.jetbrains.php.tools.quality.*
import com.vk.noverify.NoVerifyConfigurationBaseManager.Companion.NOVERIFY

// TODO: change to PhpStanOptionsPanel
class NoVerifyConfigurableForm(project: Project, configuration: NoVerifyConfiguration) :
QualityToolConfigurableForm<NoVerifyConfiguration>(project, configuration, NOVERIFY, "Noverify") {
override fun getQualityToolType(): QualityToolType<QualityToolConfiguration> {
Expand Down
18 changes: 7 additions & 11 deletions src/main/kotlin/com/vk/noverify/NoVerifyCustomOptionsForm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.vk.noverify
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.DialogPanel
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.Pair
import com.intellij.ui.LanguageTextField
import com.intellij.ui.RelativeFont
Expand All @@ -19,6 +18,7 @@ class NoVerifyCustomOptionsForm(
private val configuration: NoVerifyConfiguration,
) : QualityToolCustomSettings() {

// TODO: maybe use NoVerifyConfiguration?
data class Model(
var asKphp: Boolean = false,
var coresCount: Int = Runtime.getRuntime().availableProcessors(),
Expand All @@ -28,7 +28,7 @@ class NoVerifyCustomOptionsForm(
var customParameters: String = "",
)

private lateinit var centralPanel: DialogPanel
private lateinit var panel: DialogPanel
private val model = Model()

override fun createComponent(): JComponent {
Expand All @@ -37,7 +37,7 @@ class NoVerifyCustomOptionsForm(
val excludeRegexpTextField = LanguageTextField(RegExpLanguage.INSTANCE, project, "", true)
val unusedVarRegexpTextField = LanguageTextField(RegExpLanguage.INSTANCE, project, "", true)

centralPanel = panel {
panel = panel {
row {
checkBox("Interpret code as KPHP")
.align(AlignX.FILL)
Expand Down Expand Up @@ -75,15 +75,11 @@ class NoVerifyCustomOptionsForm(
}
}

val disposable = Disposer.newDisposable()
centralPanel.registerValidators(disposable)
Disposer.register(project, disposable)

return centralPanel
return panel
}

override fun isModified(): Boolean {
centralPanel.reset()
panel.reset()
return model.asKphp != configuration.asKphp ||
model.coresCount != configuration.coresCount ||
model.excludeRegexp != configuration.excludeRegexp ||
Expand All @@ -93,7 +89,7 @@ class NoVerifyCustomOptionsForm(
}

override fun apply() {
centralPanel.apply()
panel.apply()

configuration.asKphp = model.asKphp
configuration.coresCount = model.coresCount
Expand All @@ -111,7 +107,7 @@ class NoVerifyCustomOptionsForm(
model.cachePath = configuration.cachePath
model.customParameters = configuration.customParameters

centralPanel.reset()
panel.reset()
}

override fun getDisplayName() = null
Expand Down
7 changes: 3 additions & 4 deletions src/main/kotlin/com/vk/noverify/NoVerifyMessageProcessor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import com.intellij.codeHighlighting.HighlightDisplayLevel
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiDocumentManager
import com.jetbrains.php.tools.quality.*
import org.jetbrains.annotations.NonNls

class NoVerifyMessageProcessor(private val info: QualityToolAnnotatorInfo<*>) : QualityToolMessageProcessor(info) {
override fun getQualityToolType(): QualityToolType<NoVerifyConfiguration> {
return NoVerifyQualityToolType.INSTANCE
}

override fun getMessagePrefix(): @NonNls String {
override fun getMessagePrefix(): String {
return "Noverify"
}

Expand Down Expand Up @@ -92,7 +91,7 @@ class NoVerifyMessageProcessor(private val info: QualityToolAnnotatorInfo<*>) :
}

companion object {
private const val MESSAGE_START: @NonNls String = "{"
private const val MESSAGE_END: @NonNls String = "}"
private const val MESSAGE_START: String = "{"
private const val MESSAGE_END: String = "}"
}
}
Loading