Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
0caa67bf
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
0caa67bf
编写于
12月 30, 2019
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: extract model
上级
cab546e7
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
29 deletion
+31
-29
cmd/api.go
cmd/api.go
+0
-2
cmd/bs.go
cmd/bs.go
+1
-1
core/context/evaluate/analyser.go
core/context/evaluate/analyser.go
+1
-1
core/context/evaluate/evaluator/service.go
core/context/evaluate/evaluator/service.go
+2
-1
core/domain/jannotation.go
core/domain/jannotation.go
+19
-0
core/domain/jmethod.go
core/domain/jmethod.go
+0
-23
core/domain/jparameter.go
core/domain/jparameter.go
+7
-0
core/infrastructure/string_array.go
core/infrastructure/string_array.go
+1
-1
未找到文件。
cmd/api.go
浏览文件 @
0caa67bf
...
...
@@ -2,7 +2,6 @@ package cmd
import
(
"encoding/json"
"fmt"
"github.com/olekukonko/tablewriter"
"github.com/phodal/coca/cmd/cmd_util"
"github.com/phodal/coca/config"
...
...
@@ -68,7 +67,6 @@ var apiCmd = &cobra.Command{
restFieldsApi
:=
filterApi
(
apiPrefix
,
restApis
)
fmt
.
Println
(
restApis
)
analyser
:=
call_graph
.
NewCallGraph
()
dotContent
,
counts
:=
analyser
.
AnalysisByFiles
(
restFieldsApi
,
parsedDeps
,
diMap
)
...
...
cmd/bs.go
浏览文件 @
0caa67bf
...
...
@@ -69,7 +69,7 @@ func isSmellHaveSize(key string) bool {
"longMethod"
,
"dataClass"
,
}
return
infrastructure
.
Contains
(
smellList
,
key
)
return
infrastructure
.
StringArray
Contains
(
smellList
,
key
)
}
func
init
()
{
...
...
core/context/evaluate/analyser.go
浏览文件 @
0caa67bf
...
...
@@ -49,7 +49,7 @@ func (a Analyser) Analysis(classNodes []domain.JClassNode, identifiers []domain.
for
_
,
method
:=
range
ident
.
Methods
{
result
.
Summary
.
MethodCount
++
if
infrastructure
.
Contains
(
method
.
Modifiers
,
"static"
)
{
if
infrastructure
.
StringArray
Contains
(
method
.
Modifiers
,
"static"
)
{
result
.
Summary
.
StaticMethodCount
++
}
...
...
core/context/evaluate/evaluator/service.go
浏览文件 @
0caa67bf
...
...
@@ -70,7 +70,8 @@ func (s Service) Evaluate(result *EvaluateModel, node domain.JClassNode) {
if
s
.
enableAbstractParameters
()
{
for
_
,
method
:=
range
node
.
Methods
{
if
len
(
method
.
Parameters
)
>=
4
{
PARAMETERR_LENGTH_LIMIT
:=
4
if
len
(
method
.
Parameters
)
>=
PARAMETERR_LENGTH_LIMIT
{
longParameterList
=
append
(
longParameterList
,
method
)
}
}
...
...
core/domain/jannotation.go
0 → 100644
浏览文件 @
0caa67bf
package
domain
type
Annotation
struct
{
QualifiedName
string
ValuePairs
[]
AnnotationKeyValue
}
type
AnnotationKeyValue
struct
{
Key
string
Value
string
}
func
NewAnnotation
()
Annotation
{
return
*&
Annotation
{
QualifiedName
:
""
,
ValuePairs
:
nil
,
}
}
core/domain/jmethod.go
浏览文件 @
0caa67bf
...
...
@@ -17,24 +17,6 @@ type JMethod struct {
Creators
[]
JClassNode
}
type
Annotation
struct
{
QualifiedName
string
ValuePairs
[]
AnnotationKeyValue
}
type
AnnotationKeyValue
struct
{
Key
string
Value
string
}
func
NewAnnotation
()
Annotation
{
return
*&
Annotation
{
QualifiedName
:
""
,
ValuePairs
:
nil
,
}
}
// TODO support annnotation
func
NewJMethod
()
JMethod
{
return
*&
JMethod
{
Name
:
""
,
...
...
@@ -50,11 +32,6 @@ func NewJMethod() JMethod {
}
}
type
JParameter
struct
{
Name
string
Type
string
}
type
JMethodInfo
struct
{
Name
string
Type
string
...
...
core/domain/jparameter.go
0 → 100644
浏览文件 @
0caa67bf
package
domain
type
JParameter
struct
{
Name
string
Type
string
}
core/infrastructure/string_array.go
浏览文件 @
0caa67bf
...
...
@@ -2,7 +2,7 @@ package infrastructure
import
"sort"
func
Contains
(
s
[]
string
,
searchterm
string
)
bool
{
func
StringArray
Contains
(
s
[]
string
,
searchterm
string
)
bool
{
i
:=
sort
.
SearchStrings
(
s
,
searchterm
)
return
i
<
len
(
s
)
&&
s
[
i
]
==
searchterm
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录