Skip to content

Commit

Permalink
version to 2.0.1.2x
Browse files Browse the repository at this point in the history
version to 2.0.1.2x
  • Loading branch information
XenoAmess authored Apr 11, 2020
2 parents 1e906f1 + 71bb6a7 commit ed22e3c
Show file tree
Hide file tree
Showing 44 changed files with 781 additions and 198 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@ hsf.configuration/
*.instance
out
!/p3c-idea/src/main/kotlin/com/alibaba/smartfox/work/tools/aone/ui/AoneBranchView.kt

#versions-maven-plugin
*.versionsBackup
17 changes: 17 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cd ./p3c-pmd
call mvn clean install -Dmaven.javadoc.skip=false -e
cd ../
cd ./idea-plugin

cd ./p3c-common
call ../gradlew publishToMavenLocal
cd ../

cd ./p3c-idea
call ../gradlew publishToMavenLocal
cd ../

call ./gradlew buildPlugin

cd ../
pause
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ package com.alibaba.smartfox.eclipse.pmd

enum class RulePriority(val priority: Int, val title: String) {

Blocker(1, "Blocker"), Critical(2, "Critical"), Major(3, "Major");
Blocker(1, "Blocker"),
Critical(2, "Critical"),
Major(3, "Major"),
Warning(4, "Warning"),
WeakWarning(5, "Weak Warning");

override fun toString(): String {
return title
Expand All @@ -28,7 +32,7 @@ enum class RulePriority(val priority: Int, val title: String) {
try {
return RulePriority.values()[priority - 1]
} catch (e: ArrayIndexOutOfBoundsException) {
return Major
return WeakWarning
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ object InspectionResults {

return "${map[RulePriority.Blocker.title]?.count ?: 0} Blockers," +
"${map[RulePriority.Critical.title]?.count ?: 0} Criticals," +
"${map[RulePriority.Major.title]?.count ?: 0} Majors"
"${map[RulePriority.Major.title]?.count ?: 0} Majors," +
"${map[RulePriority.Warning.title]?.count ?: 0} Warnings," +
"${map[RulePriority.WeakWarning.title]?.count ?: 0} Weak Warnings"
}
}
8 changes: 4 additions & 4 deletions eclipse-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<properties>
<tycho.version>1.0.0</tycho.version>
<tycho-extras.version>${tycho.version}</tycho-extras.version>
<eclipse-repo.url>http://download.eclipse.org/releases/neon</eclipse-repo.url>
<eclipse-repo.url>https://download.eclipse.org/releases/neon</eclipse-repo.url>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ajdt-eclipse-repo.url>http://download.eclipse.org/tools/ajdt/46/dev/update</ajdt-eclipse-repo.url>
<ajdt-eclipse-repo.url>https://download.eclipse.org/tools/ajdt/46/dev/update</ajdt-eclipse-repo.url>
<kotlin.version>1.3.30</kotlin.version>
<eclipse-release>juno</eclipse-release>
</properties>
Expand Down Expand Up @@ -44,7 +44,7 @@
<repository>
<id>juno</id>
<layout>p2</layout>
<url>http://mirrors.ustc.edu.cn/eclipse/releases/juno/</url>
<url>https://mirrors.ustc.edu.cn/eclipse/releases/juno/</url>
</repository>
<repository>
<id>sonatype-nexus-snapshots</id>
Expand Down Expand Up @@ -187,7 +187,7 @@
<baselineReplace>none</baselineReplace>
<baselineRepositories>
<repository>
<url>http://download.eclipse.org/eclipse/updates/4.4</url>
<url>https://download.eclipse.org/eclipse/updates/4.4</url>
</repository>
</baselineRepositories>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion idea-plugin/README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Alt+Enter键可呼出Intention菜单,不同的规则会提示不同信息的Qu
![](https://gw.alicdn.com/tfscom/TB1ObqXifxNTKJjy0FjXXX6yVXa.png)

#### 扫描结果
检测结果直接使用IDEA Run Inspection By Name功能的结果界面,插件的检测结果分级为Blocker、Critical、Major。默认按等级分组,方便统计每个级别错误的数量。
检测结果直接使用IDEA Run Inspection By Name功能的结果界面,插件的检测结果分级为Blocker、Critical、Major、Warning、Weak Warning。默认按等级分组,方便统计每个级别错误的数量。

![](https://gw.alicdn.com/tfscom/TB1aC1yifJNTKJjSspoXXc6mpXa.png)

Expand Down
2 changes: 1 addition & 1 deletion idea-plugin/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ idea_version=IU-201.6668.121
plugin_name=Alibaba Java Coding Guidelines
gradle_jetbrains_version=0.4.16
systemProp.file.encoding=UTF-8
plugin_version=2.0.1.1x
plugin_version=2.0.1.2x-SNAPSHOT
6 changes: 3 additions & 3 deletions idea-plugin/p3c-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ version '2.0.1'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

dependencies {
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.25-incubating'
compile 'com.alibaba.p3c:p3c-pmd:2.0.1.1x'
compile group: 'org.javassist', name: 'javassist', version: '3.21.0-GA'
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.30'
compile 'com.alibaba.p3c:p3c-pmd:2.0.1.2x-SNAPSHOT'
compile group: 'org.javassist', name: 'javassist', version: '3.27.0-GA'
}

uploadArchives {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.intellij.openapi.project.Project
* @author caikang
* @date 2017/06/19
*/
class CommonSettingsApplicationStartupActivity() : AliBaseApplicationStartupActivity {
class CommonSettingsApplicationStartupActivity : AliBaseApplicationStartupActivity {
companion object {
val analyticsGroupId = "com.alibaba.p3c.analytics.action_group"
val analyticsGroupText = "$analyticsGroupId.text"
Expand All @@ -42,6 +42,8 @@ class CommonSettingsApplicationStartupActivity() : AliBaseApplicationStartupActi
SeverityRegistrar.registerStandard(HighlightInfoTypes.BLOCKER, HighlightSeverities.BLOCKER)
SeverityRegistrar.registerStandard(HighlightInfoTypes.CRITICAL, HighlightSeverities.CRITICAL)
SeverityRegistrar.registerStandard(HighlightInfoTypes.MAJOR, HighlightSeverities.MAJOR)
SeverityRegistrar.registerStandard(HighlightInfoTypes.WARNING, HighlightSeverities.WARNING)
SeverityRegistrar.registerStandard(HighlightInfoTypes.WEAK_WARNING, HighlightSeverities.WEAK_WARNING)

I18nResources.changeLanguage(p3cConfig.locale)
val analyticsGroup = ActionManager.getInstance().getAction(analyticsGroupId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ package com.alibaba.p3c.idea.inspection
* @date 2017/03/16
6
*/
interface PmdRuleInspectionIdentify {
}
interface PmdRuleInspectionIdentify
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ object RuleInspectionUtils {
when (rulePriority) {
RulePriority.HIGH -> return HighlightDisplayLevels.BLOCKER
RulePriority.MEDIUM_HIGH -> return HighlightDisplayLevels.CRITICAL
else -> return HighlightDisplayLevels.MAJOR
RulePriority.MEDIUM -> return HighlightDisplayLevels.MAJOR
RulePriority.MEDIUM_LOW -> return HighlightDisplayLevels.WARNING
else -> return HighlightDisplayLevels.WEAK_WARNING
}
}

Expand All @@ -110,8 +112,7 @@ object RuleInspectionUtils {
map.put("message", StringUtils.trimToEmpty(rule.message))
map.put("description", StringUtils.trimToEmpty(rule.description))
val examples = rule.examples.map {
it?.trim {
c ->
it?.trim { c ->
c == '\n'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ object HighlightDisplayLevels {
val BLOCKER = HighlightDisplayLevel(HighlightSeverities.BLOCKER, HighlightDisplayLevel.ERROR.icon)
val CRITICAL = HighlightDisplayLevel(HighlightSeverities.CRITICAL, HighlightDisplayLevel.WARNING.icon)
val MAJOR = HighlightDisplayLevel(HighlightSeverities.MAJOR, HighlightDisplayLevel.WEAK_WARNING.icon)
val WARNING = HighlightDisplayLevel(HighlightSeverities.WARNING, HighlightDisplayLevel.WEAK_WARNING.icon)
val WEAK_WARNING = HighlightDisplayLevel(HighlightSeverities.WEAK_WARNING, HighlightDisplayLevel.INFO.icon)
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ object HighlightInfoTypes {
CodeInsightColors.WARNINGS_ATTRIBUTES)
val MAJOR: HighlightInfoType = HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverities.MAJOR,
CodeInsightColors.WEAK_WARNING_ATTRIBUTES)
val WARNING: HighlightInfoType = HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverities.WARNING,
CodeInsightColors.WEAK_WARNING_ATTRIBUTES)
val WEAK_WARNING: HighlightInfoType = HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverities.WEAK_WARNING,
CodeInsightColors.INFO_ATTRIBUTES)
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ import com.intellij.lang.annotation.HighlightSeverity
* @date 2017/02/04
*/
object HighlightSeverities {
val BLOCKER = HighlightSeverity("BLOCKER", 399)

val CRITICAL = HighlightSeverity("CRITICAL", 398)

val MAJOR = HighlightSeverity("MAJOR", 397)

val WARNING = HighlightSeverity("WARNING", 396)

/**
* The standard severity level for warning annotations.
*/
val CRITICAL = HighlightSeverity("CRITICAL", 398)
val WEAK_WARNING = HighlightSeverity("WEAK_WARNING", 395)

/**
* The standard severity level for error annotations.
*/
val BLOCKER = HighlightSeverity("BLOCKER", 399)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ import com.intellij.openapi.startup.StartupActivity
* @author caikang
* @date 2017/05/11
*/
interface AliBaseApplicationStartupActivity : StartupActivity {
}
interface AliBaseApplicationStartupActivity : StartupActivity
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ object BalloonNotifications {

object LogNotifications {

val group = buildNotificationGroup(displayId = BalloonNotifications.displayId, displayType = NotificationDisplayType.NONE, isLogByDefault = true);
val group = buildNotificationGroup(displayId = BalloonNotifications.displayId, displayType = NotificationDisplayType.NONE, isLogByDefault = true)

fun log(message: String, project: Project? = ProjectManager.getInstance().defaultProject,
title: String = BalloonNotifications.TITLE,
Expand All @@ -118,8 +118,8 @@ fun buildNotificationGroup(displayId: String, displayType: NotificationDisplayTy
notificationGroupClass.constructors.forEach {
if (it.parameters.size == 3) {
return it.newInstance(displayId, displayType, isLogByDefault)
as NotificationGroup;
as NotificationGroup
}
}
throw MethodNotSupportedException("cannot find a suitable constructor for NotificationGroup who accepts [String,NotificationDisplayType,Boolean]");
throw MethodNotSupportedException("cannot find a suitable constructor for NotificationGroup who accepts [String,NotificationDisplayType,Boolean]")
}
54 changes: 16 additions & 38 deletions idea-plugin/p3c-common/src/main/resources/messages/P3cBundle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<entry key="com.alibaba.p3c.analytics.action_group.text">阿里编码规约</entry>
<entry key="com.alibaba.p3c.action.switch_language.text.cur_zh">切换语言至英文(English)</entry>
<entry key="com.alibaba.p3c.action.switch_language.text.cur_en">切换语言至中文</entry>
<entry key="com.alibaba.p3c.action.switch_language.text.success">
<![CDATA[切换语言成功,<a href="restart">重启</a>后生效]]></entry>
<entry key="com.alibaba.p3c.action.switch_language.text.success"><![CDATA[切换语言成功,<a href="restart">重启</a>后生效]]></entry>
<entry key="com.alibaba.p3c.idea.action.AliInspectionAction.text">编码规约扫描</entry>
<entry key="com.alibaba.p3c.idea.action.ToggleProjectInspectionAction.text.close">关闭实时检测功能</entry>
<entry key="com.alibaba.p3c.idea.action.ToggleProjectInspectionAction.text.open">打开实时检测功能</entry>
Expand All @@ -15,48 +14,28 @@
<entry key="com.alibaba.p3c.idea.quickfix.variable.lowerCamelCase">修改为小写驼峰命名(lowerCamelCase)</entry>
<entry key="com.alibaba.p3c.idea.quickfix.vm.add!">为变量添加!</entry>
<entry key="com.alibaba.p3c.idea.quickfix.replace.with">替换为</entry>
<entry key="com.alibaba.p3c.idea.quickfix.standalone.AliAccessStaticViaInstanceInspection">通过类 '%s' 直接访问静态成员
'%s.%s'
</entry>
<entry key="com.alibaba.p3c.idea.quickfix.standalone.AliAccessStaticViaInstanceInspection">通过类 '%s' 直接访问静态成员 '%s.%s'</entry>
<entry key="com.alibaba.p3c.idea.quickfix.standalone.AliMissingOverrideAnnotationInspection">添加 @Override 注解</entry>
<entry key="com.alibaba.p3c.idea.quickfix.NeedBraceRule">为语句加上大括号</entry>
<entry key="com.alibaba.p3c.idea.quickfix.AliEqualsAvoidNull">翻转 equals 调用</entry>
<entry key="com.alibaba.p3c.idea.quickfix.ArrayNamingShouldHaveBracketRule">修改为 String[] str 模式</entry>
<entry key="com.alibaba.p3c.idea.quickfix.AliLongLiteralsEndingWithLowercaseL">'l' 替换为 'L'</entry>

<entry key="com.alibaba.p3c.idea.inspection.equals.instead.quality">
<![CDATA[包装类型间的相等判断应该用equals,而不是<code>#ref</code> #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.AliAccessStaticViaInstanceInspection.message">
避免通过一个类的对象引用访问此类的静态变量或静态方法,无谓增加编译器解析成本,直接用类名来访问即可。
</entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.AliAccessStaticViaInstanceInspection.errMsg">不应该通过类实例访问静态成员
%s #loc
</entry>
<entry key="com.alibaba.p3c.idea.inspection.equals.instead.quality"><![CDATA[包装类型间的相等判断应该用equals,而不是<code>#ref</code> #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.AliAccessStaticViaInstanceInspection.message">避免通过一个类的对象引用访问此类的静态变量或静态方法,无谓增加编译器解析成本,直接用类名来访问即可。</entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.AliAccessStaticViaInstanceInspection.errMsg">不应该通过类实例访问静态成员 %s #loc</entry>

<entry key="com.alibaba.p3c.idea.inspection.standalone.AliDeprecationInspection.message">不能使用过时的类或方法。</entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.AliMissingOverrideAnnotationInspection.message">
所有的覆写方法,必须加@Override注解。
</entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.AliMissingOverrideAnnotationInspection.errMsg">
<![CDATA[<code>#ref()</code>缺少 '@Override' 注解 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.MapOrSetKeyShouldOverrideHashCodeEqualsInspection.message">
Map/Set的key为自定义对象时,必须重写hashCode和equals。
</entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.MapOrSetKeyShouldOverrideHashCodeEqualsInspection.errMsg">
参数类型 %s 没有重写hashCode和equals #loc
</entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.AvoidCallStaticSimpleDateFormatRule.errMsg">
<![CDATA[<code>#ref</code> 是非线程安全的,请加锁或者使用局部变量 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.NeedBraceRule.errMsg">
<![CDATA[<code>#ref</code> 没有加大括号 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.AliEqualsAvoidNull.errMsg">
<![CDATA[<code>#ref</code> 应该作为方法 "%s()"的调用方,而不是参数 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.ArrayNamingShouldHaveBracketRule.errMsg">
<![CDATA[{0, choice, 1#字段|2#参数|3#变量} <code>#ref</code> 数组定义格式错误 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.AliLongLiteralsEndingWithLowercaseL.errMsg">
<![CDATA['long' 型常量 <code>#ref</code> 应该以大写L结尾 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.WrapperTypeEqualityRule.errMsg">
<![CDATA[包装类型间的相等判断应该用equals,而不是<code>#ref</code> #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.AliMissingOverrideAnnotationInspection.message">所有的覆写方法,必须加@Override注解。</entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.AliMissingOverrideAnnotationInspection.errMsg"><![CDATA[<code>#ref()</code>缺少 '@Override' 注解 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.MapOrSetKeyShouldOverrideHashCodeEqualsInspection.message">Map/Set的key为自定义对象时,必须重写hashCode和equals。</entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.MapOrSetKeyShouldOverrideHashCodeEqualsInspection.errMsg">参数类型 %s 没有重写hashCode和equals #loc</entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.AvoidCallStaticSimpleDateFormatRule.errMsg"><![CDATA[<code>#ref</code> 是非线程安全的,请加锁或者使用局部变量 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.NeedBraceRule.errMsg"><![CDATA[<code>#ref</code> 没有加大括号 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.AliEqualsAvoidNull.errMsg"><![CDATA[<code>#ref</code> 应该作为方法 "%s()"的调用方,而不是参数 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.ArrayNamingShouldHaveBracketRule.errMsg"><![CDATA[{0, choice, 1#字段|2#参数|3#变量} <code>#ref</code> 数组定义格式错误 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.AliLongLiteralsEndingWithLowercaseL.errMsg"><![CDATA['long' 型常量 <code>#ref</code> 应该以大写L结尾 #loc]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.rule.WrapperTypeEqualityRule.errMsg"><![CDATA[包装类型间的相等判断应该用equals,而不是<code>#ref</code> #loc]]></entry>

<entry key="com.alibaba.p3c.idea.inspection.standalone.AliAccessStaticViaInstanceInspection.desc"><![CDATA[
<html>
Expand All @@ -81,8 +60,7 @@
</body>
</html>
]]></entry>
<entry key="com.alibaba.p3c.idea.inspection.standalone.MapOrSetKeyShouldOverrideHashCodeEqualsInspection.desc">
<![CDATA[
<entry key="com.alibaba.p3c.idea.inspection.standalone.MapOrSetKeyShouldOverrideHashCodeEqualsInspection.desc"><![CDATA[
<html>
<body>
Map/Set的key为自定义对象时,必须重写hashCode和equals。<br>
Expand Down
Loading

0 comments on commit ed22e3c

Please sign in to comment.