Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
43d0a3ca
C
Coca
项目概览
Phodal
/
Coca
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Coca
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
43d0a3ca
编写于
12月 29, 2019
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: update performance for tbs
上级
ddd69770
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
35 deletion
+30
-35
core/domain/tbs/tbs_app.go
core/domain/tbs/tbs_app.go
+30
-35
未找到文件。
core/domain/tbs/tbs_app.go
浏览文件 @
43d0a3ca
...
@@ -24,11 +24,13 @@ func (a TbsApp) AnalysisPath(deps []models.JClassNode, identifiersMap map[string
...
@@ -24,11 +24,13 @@ func (a TbsApp) AnalysisPath(deps []models.JClassNode, identifiersMap map[string
for
_
,
clz
:=
range
deps
{
for
_
,
clz
:=
range
deps
{
// TODO refactoring identify & annotation
// TODO refactoring identify & annotation
for
_
,
method
:=
range
clz
.
Methods
{
for
_
,
method
:=
range
clz
.
Methods
{
checkIgnoreTest
(
clz
.
Path
,
method
,
&
results
)
for
_
,
annotation
:=
range
method
.
Annotations
{
checkEmptyTest
(
clz
.
Path
,
method
,
&
results
)
checkIgnoreTest
(
clz
.
Path
,
annotation
,
&
results
)
checkRedundantPrintTest
(
clz
.
Path
,
method
,
&
results
)
checkEmptyTest
(
clz
.
Path
,
annotation
,
&
results
,
method
)
}
for
_
,
methodCall
:=
range
method
.
MethodCalls
{
for
_
,
methodCall
:=
range
method
.
MethodCalls
{
checkRedundantPrintTest
(
clz
.
Path
,
methodCall
,
&
results
)
checkUnknownTest
(
clz
.
Path
,
methodCall
,
&
results
)
checkUnknownTest
(
clz
.
Path
,
methodCall
,
&
results
)
}
}
}
}
...
@@ -50,12 +52,25 @@ func checkUnknownTest(path string, method models.JMethodCall, results *[]TestBad
...
@@ -50,12 +52,25 @@ func checkUnknownTest(path string, method models.JMethodCall, results *[]TestBad
}
}
}
}
func
checkRedundantPrintTest
(
path
string
,
method
models
.
JMethod
,
results
*
[]
TestBadSmell
)
{
func
checkRedundantPrintTest
(
path
string
,
mCall
models
.
JMethodCall
,
results
*
[]
TestBadSmell
)
{
for
_
,
method
:=
range
method
.
MethodCalls
{
if
mCall
.
Class
==
"System.out"
&&
(
mCall
.
MethodName
==
"println"
||
mCall
.
MethodName
==
"printf"
||
mCall
.
MethodName
==
"print"
)
{
if
method
.
Class
==
"System.out"
&&
(
method
.
MethodName
==
"println"
||
method
.
MethodName
==
"printf"
||
method
.
MethodName
==
"print"
)
{
tbs
:=
*&
TestBadSmell
{
FileName
:
path
,
Type
:
"RedundantPrintTest"
,
Description
:
""
,
Line
:
0
,
}
*
results
=
append
(
*
results
,
tbs
)
}
}
func
checkEmptyTest
(
path
string
,
annotation
models
.
Annotation
,
results
*
[]
TestBadSmell
,
method
models
.
JMethod
)
{
if
annotation
.
QualifiedName
==
"Test"
{
if
len
(
method
.
MethodCalls
)
<=
1
{
tbs
:=
*&
TestBadSmell
{
tbs
:=
*&
TestBadSmell
{
FileName
:
path
,
FileName
:
path
,
Type
:
"
RedundantPrint
Test"
,
Type
:
"
Empty
Test"
,
Description
:
""
,
Description
:
""
,
Line
:
0
,
Line
:
0
,
}
}
...
@@ -65,35 +80,15 @@ func checkRedundantPrintTest(path string, method models.JMethod, results *[]Test
...
@@ -65,35 +80,15 @@ func checkRedundantPrintTest(path string, method models.JMethod, results *[]Test
}
}
}
}
func
checkEmptyTest
(
path
string
,
method
models
.
JMethod
,
results
*
[]
TestBadSmell
)
{
func
checkIgnoreTest
(
clzPath
string
,
annotation
models
.
Annotation
,
results
*
[]
TestBadSmell
)
{
for
_
,
annotation
:=
range
method
.
Annotations
{
if
annotation
.
QualifiedName
==
"Ignore"
{
if
annotation
.
QualifiedName
==
"Test"
{
tbs
:=
*&
TestBadSmell
{
if
len
(
method
.
MethodCalls
)
<=
1
{
FileName
:
clzPath
,
tbs
:=
*&
TestBadSmell
{
Type
:
"IgnoreTest"
,
FileName
:
path
,
Description
:
""
,
Type
:
"EmptyTest"
,
Line
:
0
,
Description
:
""
,
Line
:
0
,
}
*
results
=
append
(
*
results
,
tbs
)
}
}
}
}
}
*
results
=
append
(
*
results
,
tbs
)
func
checkIgnoreTest
(
clzPath
string
,
method
models
.
JMethod
,
results
*
[]
TestBadSmell
)
{
for
_
,
annotation
:=
range
method
.
Annotations
{
if
annotation
.
QualifiedName
==
"Ignore"
{
tbs
:=
*&
TestBadSmell
{
FileName
:
clzPath
,
Type
:
"IgnoreTest"
,
Description
:
""
,
Line
:
0
,
}
*
results
=
append
(
*
results
,
tbs
)
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录