Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wangsun300
p3c
提交
6cc59402
P
p3c
项目概览
wangsun300
/
p3c
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
p3c
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
6cc59402
编写于
12月 27, 2017
作者:
玄
玄坛
提交者:
GitHub
12月 27, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #220 from SeanCai/master
fix some issues
上级
34ed9d82
0d2dc579
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
23 addition
and
16 deletion
+23
-16
idea-plugin/p3c-common/src/main/kotlin/com/alibaba/p3c/idea/inspection/AliLocalInspectionToolProvider.kt
...aba/p3c/idea/inspection/AliLocalInspectionToolProvider.kt
+0
-1
idea-plugin/p3c-common/src/main/kotlin/com/alibaba/p3c/idea/inspection/standalone/AliDeprecationInspection.kt
...3c/idea/inspection/standalone/AliDeprecationInspection.kt
+2
-2
idea-plugin/p3c-common/src/main/kotlin/com/alibaba/p3c/idea/pmd/SourceCodeProcessor.kt
...in/kotlin/com/alibaba/p3c/idea/pmd/SourceCodeProcessor.kt
+5
-7
idea-plugin/p3c-common/src/main/resources/icons/alibaba.png
idea-plugin/p3c-common/src/main/resources/icons/alibaba.png
+0
-0
idea-plugin/p3c-common/src/main/resources/rulesets/java/ali-pmd.xml
...n/p3c-common/src/main/resources/rulesets/java/ali-pmd.xml
+1
-3
p3c-pmd/src/main/java/com/alibaba/p3c/pmd/fix/FixClassTypeResolver.java
...in/java/com/alibaba/p3c/pmd/fix/FixClassTypeResolver.java
+3
-0
p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/java/rule/exception/TransactionMustHaveRollbackRule.java
.../java/rule/exception/TransactionMustHaveRollbackRule.java
+12
-3
未找到文件。
idea-plugin/p3c-common/src/main/kotlin/com/alibaba/p3c/idea/inspection/AliLocalInspectionToolProvider.kt
浏览文件 @
6cc59402
...
...
@@ -74,7 +74,6 @@ class AliLocalInspectionToolProvider : InspectionToolProvider {
AliAccessStaticViaInstanceInspection
::
class
.
java
,
AliDeprecationInspection
::
class
.
java
,
MapOrSetKeyShouldOverrideHashCodeEqualsInspection
::
class
.
java
,
AliAccessToNonThreadSafeStaticFieldFromInstanceInspection
::
class
.
java
,
AliArrayNamingShouldHaveBracketInspection
::
class
.
java
,
AliControlFlowStatementWithoutBracesInspection
::
class
.
java
,
AliEqualsAvoidNullInspection
::
class
.
java
,
...
...
idea-plugin/p3c-common/src/main/kotlin/com/alibaba/p3c/idea/inspection/standalone/AliDeprecationInspection.kt
浏览文件 @
6cc59402
...
...
@@ -37,7 +37,7 @@ import javax.swing.JComponent
* @date 2016/12/08
*/
class
AliDeprecationInspection
:
DeprecationInspection
,
AliBaseInspection
{
val
messageKey
=
"com.alibaba.p3c.idea.inspection.standalone.AliDeprecationInspection"
private
val
messageKey
=
"com.alibaba.p3c.idea.inspection.standalone.AliDeprecationInspection"
constructor
()
/**
...
...
@@ -46,7 +46,7 @@ class AliDeprecationInspection : DeprecationInspection, AliBaseInspection {
constructor
(
any
:
Any
?)
:
this
()
init
{
IGNORE_INSIDE_DEPRECATED
=
fals
e
IGNORE_INSIDE_DEPRECATED
=
tru
e
IGNORE_ABSTRACT_DEPRECATED_OVERRIDES
=
false
IGNORE_IMPORT_STATEMENTS
=
false
IGNORE_METHODS_OF_DEPRECATED
=
false
...
...
idea-plugin/p3c-common/src/main/kotlin/com/alibaba/p3c/idea/pmd/SourceCodeProcessor.kt
浏览文件 @
6cc59402
...
...
@@ -80,13 +80,11 @@ class SourceCodeProcessor(private val configuration: PMDConfiguration) {
}
private
fun
usesDFA
(
languageVersion
:
LanguageVersion
,
rootNode
:
Node
,
ruleSets
:
RuleSets
)
{
if
(
ruleSets
.
usesDFA
(
languageVersion
.
language
))
{
val
start
=
System
.
nanoTime
()
val
dataFlowFacade
=
languageVersion
.
languageVersionHandler
.
dataFlowFacade
dataFlowFacade
.
start
(
rootNode
)
val
end
=
System
.
nanoTime
()
Benchmarker
.
mark
(
Benchmark
.
DFA
,
end
-
start
,
0
)
}
val
start
=
System
.
nanoTime
()
val
dataFlowFacade
=
languageVersion
.
languageVersionHandler
.
dataFlowFacade
dataFlowFacade
.
start
(
rootNode
)
val
end
=
System
.
nanoTime
()
Benchmarker
.
mark
(
Benchmark
.
DFA
,
end
-
start
,
0
)
}
private
fun
usesTypeResolution
(
languageVersion
:
LanguageVersion
,
rootNode
:
Node
,
ruleSets
:
RuleSets
)
{
...
...
idea-plugin/p3c-common/src/main/resources/icons/alibaba.png
查看替换文件 @
34ed9d82
浏览文件 @
6cc59402
561 字节
|
W:
|
H:
354 字节
|
W:
|
H:
2-up
Swipe
Onion skin
idea-plugin/p3c-common/src/main/resources/rulesets/java/ali-pmd.xml
浏览文件 @
6cc59402
...
...
@@ -4,9 +4,7 @@
xmlns=
"http://pmd.sourceforge.net/ruleset/2.0.0"
xsi:schemaLocation=
"http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd"
>
<rule
ref=
"rulesets/java/ali-concurrent.xml"
>
<exclude
name=
"AvoidCallStaticSimpleDateFormatRule"
/>
</rule>
<rule
ref=
"rulesets/java/ali-concurrent.xml"
/>
<rule
ref=
"rulesets/java/ali-comment.xml"
/>
<rule
ref=
"rulesets/java/ali-naming.xml"
>
<exclude
name=
"ArrayNamingShouldHaveBracketRule"
/>
...
...
p3c-pmd/src/main/java/com/alibaba/p3c/pmd/fix/FixClassTypeResolver.java
浏览文件 @
6cc59402
...
...
@@ -11,6 +11,8 @@ import java.util.Map;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.annotation.Generated
;
import
com.alibaba.p3c.pmd.lang.java.util.NumberConstants
;
import
com.alibaba.p3c.pmd.lang.java.util.StringAndCharConstants
;
...
...
@@ -77,6 +79,7 @@ import net.sourceforge.pmd.lang.java.typeresolution.PMDASMClassLoader;
* @author unknown
* @date 2016/11/21
*/
@Generated
(
"from pmd"
)
public
class
FixClassTypeResolver
extends
ClassTypeResolver
{
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
FixClassTypeResolver
.
class
.
getName
());
...
...
p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/java/rule/exception/TransactionMustHaveRollbackRule.java
浏览文件 @
6cc59402
...
...
@@ -39,6 +39,8 @@ public class TransactionMustHaveRollbackRule extends AbstractAliRule {
+
TRANSACTIONAL_ANNOTATION_NAME
;
private
static
final
String
ROLLBACK_PREFIX
=
"rollback"
;
private
static
final
String
PROPAGATION_NOT_SUPPORTED
=
"Propagation.NOT_SUPPORTED"
;
private
static
final
String
XPATH_FOR_ROLLBACK
=
"//StatementExpression/PrimaryExpression"
+
"/PrimaryPrefix/Name[ends-with(@Image,'rollback')]"
;
...
...
@@ -53,7 +55,7 @@ public class TransactionMustHaveRollbackRule extends AbstractAliRule {
return
super
.
visit
(
node
,
data
);
}
List
<
ASTMemberValuePair
>
memberValuePairList
=
node
.
findDescendantsOfType
(
ASTMemberValuePair
.
class
);
if
(
rollbackAttrSet
(
memberValuePairList
))
{
if
(
shouldSkip
(
memberValuePairList
))
{
return
super
.
visit
(
node
,
data
);
}
...
...
@@ -80,9 +82,16 @@ public class TransactionMustHaveRollbackRule extends AbstractAliRule {
return
super
.
visit
(
node
,
data
);
}
private
boolean
rollbackAttrSet
(
List
<
ASTMemberValuePair
>
memberValuePairList
)
{
private
boolean
shouldSkip
(
List
<
ASTMemberValuePair
>
memberValuePairList
)
{
for
(
ASTMemberValuePair
pair
:
memberValuePairList
)
{
if
(
pair
.
getImage
()
!=
null
&&
pair
.
getImage
().
startsWith
(
ROLLBACK_PREFIX
))
{
if
(
pair
.
getImage
()
==
null
)
{
continue
;
}
if
(
pair
.
getImage
().
startsWith
(
ROLLBACK_PREFIX
))
{
return
true
;
}
ASTName
name
=
pair
.
getFirstDescendantOfType
(
ASTName
.
class
);
if
(
name
!=
null
&&
PROPAGATION_NOT_SUPPORTED
.
equals
(
name
.
getImage
()))
{
return
true
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录