mirror of
https://github.com/alibaba/p3c.git
synced 2025-10-15 23:53:58 +00:00
idea-plugin v2.0.1
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
kotlin_version=1.3.30
|
kotlin_version=1.3.50
|
||||||
#idea_version=171.3780.15
|
#idea_version=171.3780.15
|
||||||
idea_version=145.258.11
|
idea_version=145.258.11
|
||||||
plugin_name=Alibaba Java Coding Guidelines
|
plugin_name=Alibaba Java Coding Guidelines
|
||||||
gradle_jetbrains_version=0.4.5
|
gradle_jetbrains_version=0.4.5
|
||||||
systemProp.file.encoding=UTF-8
|
systemProp.file.encoding=UTF-8
|
||||||
|
|
||||||
plugin_version=2.0.0
|
plugin_version=2.0.1
|
||||||
|
@@ -26,19 +26,27 @@ artifacts {
|
|||||||
archives sourcesJar
|
archives sourcesJar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def myPlugins = []
|
||||||
|
|
||||||
|
if (idea_version.startsWith('193.') || idea_version.startsWith('2019.3')) {
|
||||||
|
myPlugins = ['java']
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
intellij {
|
intellij {
|
||||||
version idea_version
|
version idea_version
|
||||||
|
plugins = myPlugins
|
||||||
pluginName plugin_name
|
pluginName plugin_name
|
||||||
updateSinceUntilBuild false
|
updateSinceUntilBuild false
|
||||||
sandboxDirectory "$project.buildDir/idea-sandbox/$idea_version"
|
sandboxDirectory "$project.buildDir/idea-sandbox/$idea_version"
|
||||||
}
|
}
|
||||||
version '2.0.0'
|
version '2.0.1'
|
||||||
|
|
||||||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.25-incubating'
|
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.25-incubating'
|
||||||
compile 'com.alibaba.p3c:p3c-pmd:2.0.0'
|
compile 'com.alibaba.p3c:p3c-pmd:2.0.1'
|
||||||
compile group: 'org.javassist', name: 'javassist', version: '3.21.0-GA'
|
compile group: 'org.javassist', name: 'javassist', version: '3.21.0-GA'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,7 +33,6 @@ import com.intellij.codeInspection.ui.InspectionResultsView
|
|||||||
import com.intellij.openapi.actionSystem.AnAction
|
import com.intellij.openapi.actionSystem.AnAction
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||||
import com.intellij.openapi.actionSystem.DataKeys
|
|
||||||
import com.intellij.openapi.components.ServiceManager
|
import com.intellij.openapi.components.ServiceManager
|
||||||
import com.intellij.openapi.diagnostic.Logger
|
import com.intellij.openapi.diagnostic.Logger
|
||||||
import com.intellij.openapi.module.Module
|
import com.intellij.openapi.module.Module
|
||||||
@@ -60,9 +59,9 @@ class AliInspectionAction : AnAction() {
|
|||||||
val toolWrappers = Inspections.aliInspections(project) {
|
val toolWrappers = Inspections.aliInspections(project) {
|
||||||
it.tool is AliBaseInspection
|
it.tool is AliBaseInspection
|
||||||
}
|
}
|
||||||
val psiElement = e.getData<PsiElement>(DataKeys.PSI_ELEMENT)
|
val psiElement = e.getData<PsiElement>(CommonDataKeys.PSI_ELEMENT)
|
||||||
val psiFile = e.getData<PsiFile>(DataKeys.PSI_FILE)
|
val psiFile = e.getData<PsiFile>(CommonDataKeys.PSI_FILE)
|
||||||
val virtualFile = e.getData<VirtualFile>(DataKeys.VIRTUAL_FILE)
|
val virtualFile = e.getData<VirtualFile>(CommonDataKeys.VIRTUAL_FILE)
|
||||||
val virtualFiles = e.getData<Array<VirtualFile>>(CommonDataKeys.VIRTUAL_FILE_ARRAY)
|
val virtualFiles = e.getData<Array<VirtualFile>>(CommonDataKeys.VIRTUAL_FILE_ARRAY)
|
||||||
var analysisScope: AnalysisScope? = null
|
var analysisScope: AnalysisScope? = null
|
||||||
var projectDir = false
|
var projectDir = false
|
||||||
|
@@ -48,7 +48,7 @@ import javax.annotation.Generated
|
|||||||
*/
|
*/
|
||||||
class AliLocalInspectionToolProvider : InspectionToolProvider {
|
class AliLocalInspectionToolProvider : InspectionToolProvider {
|
||||||
|
|
||||||
override fun getInspectionClasses(): Array<Class<*>> {
|
override fun getInspectionClasses(): Array<Class<out LocalInspectionTool>> {
|
||||||
return CLASS_LIST.toTypedArray()
|
return CLASS_LIST.toTypedArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ class AliLocalInspectionToolProvider : InspectionToolProvider {
|
|||||||
val ruleInfoMap: MutableMap<String, RuleInfo> = Maps.newHashMap<String, RuleInfo>()
|
val ruleInfoMap: MutableMap<String, RuleInfo> = Maps.newHashMap<String, RuleInfo>()
|
||||||
private val LOGGER = Logger.getInstance(AliLocalInspectionToolProvider::class.java)
|
private val LOGGER = Logger.getInstance(AliLocalInspectionToolProvider::class.java)
|
||||||
val ruleNames: MutableList<String> = Lists.newArrayList<String>()!!
|
val ruleNames: MutableList<String> = Lists.newArrayList<String>()!!
|
||||||
private val CLASS_LIST = Lists.newArrayList<Class<*>>()
|
private val CLASS_LIST = Lists.newArrayList<Class<LocalInspectionTool>>()
|
||||||
private val nativeInspectionToolClass = arrayListOf<Class<out LocalInspectionTool>>(
|
private val nativeInspectionToolClass = arrayListOf<Class<out LocalInspectionTool>>(
|
||||||
AliMissingOverrideAnnotationInspection::class.java,
|
AliMissingOverrideAnnotationInspection::class.java,
|
||||||
AliAccessStaticViaInstanceInspection::class.java,
|
AliAccessStaticViaInstanceInspection::class.java,
|
||||||
@@ -130,7 +130,7 @@ class AliLocalInspectionToolProvider : InspectionToolProvider {
|
|||||||
val toolClass = pool.get(LocalInspectionTool::class.java.name)
|
val toolClass = pool.get(LocalInspectionTool::class.java.name)
|
||||||
val newField = CtField(toolClass, "forJavassist", cc)
|
val newField = CtField(toolClass, "forJavassist", cc)
|
||||||
cc.addField(newField, CtField.Initializer.byNew(itClass))
|
cc.addField(newField, CtField.Initializer.byNew(itClass))
|
||||||
CLASS_LIST.add(cc.toClass())
|
CLASS_LIST.add(cc.toClass() as Class<LocalInspectionTool>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ class AliLocalInspectionToolProvider : InspectionToolProvider {
|
|||||||
val value = "\"" + ruleInfo.rule.name + "\""
|
val value = "\"" + ruleInfo.rule.name + "\""
|
||||||
val newField = CtField.make("private String ruleName = $value;", cc)
|
val newField = CtField.make("private String ruleName = $value;", cc)
|
||||||
cc.addField(newField, value)
|
cc.addField(newField, value)
|
||||||
CLASS_LIST.add(cc.toClass())
|
CLASS_LIST.add(cc.toClass() as Class<LocalInspectionTool>)
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e: NotFoundException) {
|
} catch (e: NotFoundException) {
|
||||||
|
@@ -46,8 +46,8 @@ import com.intellij.openapi.vfs.VirtualFile
|
|||||||
import com.intellij.psi.PsiDocumentManager
|
import com.intellij.psi.PsiDocumentManager
|
||||||
import com.intellij.psi.PsiManager
|
import com.intellij.psi.PsiManager
|
||||||
import com.intellij.ui.NonFocusableCheckBox
|
import com.intellij.ui.NonFocusableCheckBox
|
||||||
|
import com.intellij.util.ExceptionUtil
|
||||||
import com.intellij.util.PairConsumer
|
import com.intellij.util.PairConsumer
|
||||||
import com.intellij.vcsUtil.Rethrow
|
|
||||||
import java.awt.BorderLayout
|
import java.awt.BorderLayout
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.Arrays
|
import java.util.Arrays
|
||||||
@@ -190,7 +190,7 @@ class AliCodeAnalysisCheckinHandler(
|
|||||||
})
|
})
|
||||||
if (!exception.isNull) {
|
if (!exception.isNull) {
|
||||||
val t = exception.get()
|
val t = exception.get()
|
||||||
Rethrow.reThrowRuntime(t)
|
ExceptionUtil.rethrowAllAsUnchecked(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.get()
|
return result.get()
|
||||||
|
@@ -4,9 +4,15 @@ plugins {
|
|||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
apply plugin: 'idea'
|
apply plugin: 'idea'
|
||||||
|
|
||||||
|
def myPlugins = ['git4idea']
|
||||||
|
|
||||||
|
if (idea_version.startsWith('193.') || idea_version.startsWith('2019.3')) {
|
||||||
|
myPlugins = ['git4idea', 'java']
|
||||||
|
}
|
||||||
|
|
||||||
intellij {
|
intellij {
|
||||||
version idea_version
|
version idea_version
|
||||||
plugins 'git4idea'
|
plugins = myPlugins
|
||||||
pluginName plugin_name
|
pluginName plugin_name
|
||||||
updateSinceUntilBuild false
|
updateSinceUntilBuild false
|
||||||
sandboxDirectory "idea-sandbox"
|
sandboxDirectory "idea-sandbox"
|
||||||
|
@@ -6,6 +6,14 @@
|
|||||||
<change-notes>
|
<change-notes>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<ul>
|
<ul>
|
||||||
|
2.0.1
|
||||||
|
<li>Fix idea 2019.3 compatibility issue</li>
|
||||||
|
<li>fix https://github.com/alibaba/p3c/issues/540</li>
|
||||||
|
<li>fix https://github.com/alibaba/p3c/issues/209</li>
|
||||||
|
<li>fix https://github.com/alibaba/p3c/issues/579</li>
|
||||||
|
<li>Add code style rule of lock</li>
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
2.0.0
|
2.0.0
|
||||||
<li>supported min idea version 2016.1(145.258.11)</li>
|
<li>supported min idea version 2016.1(145.258.11)</li>
|
||||||
<li>supported min jdk version 1.8</li>
|
<li>supported min jdk version 1.8</li>
|
||||||
|
Reference in New Issue
Block a user