Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
f2576cf4
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 搜索 >>
未验证
提交
f2576cf4
编写于
12月 15, 2019
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs: update docs
上级
4408c5ef
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
223 addition
and
6 deletion
+223
-6
README.md
README.md
+23
-4
cmd/call_graph.go
cmd/call_graph.go
+1
-1
docs/sample/call_demo.svg
docs/sample/call_demo.svg
+199
-0
src/domain/call_graph.go
src/domain/call_graph.go
+0
-1
未找到文件。
README.md
浏览文件 @
f2576cf4
...
...
@@ -8,7 +8,6 @@ install
go get https://github.com/phodal/coca
```
help:
```
...
...
@@ -25,14 +24,34 @@ Available Commands:
```
Analysis
### Analysis
```
coca analysis -p [PATH]
```
Refactor
### Build Deps Tree
```
coca call -c com.phodal.pholedge.book.BookController.createBook -d deps.json -r com.phodal.pholedge.
```
![
Call Demo
](
docs/sample/call_demo.svg
)
### Identify Spring API
```
coca api -p examples/api -d deps.json
```
### Refactor
support:
-
rename
-
move
-
remove unused import
-
remove unused class
```
coca refactor -R rename.coca -D deps.json -p src/main
...
...
cmd/call_graph.go
浏览文件 @
f2576cf4
...
...
@@ -38,7 +38,7 @@ var callGraphCmd *cobra.Command = &cobra.Command{
WriteToFile
(
"call.dot"
,
content
)
cmd
:=
exec
.
Command
(
"dot"
,
[]
string
{
"-Tsvg"
,
"call.dot"
,
"-o"
,
"call.svg"
}
...
)
cmd
:=
exec
.
Command
(
"dot"
,
[]
string
{
"-Tsvg"
,
"call.dot"
,
"-o"
,
"call
_demo
.svg"
}
...
)
_
,
err
:=
cmd
.
CombinedOutput
()
if
err
!=
nil
{
log
.
Fatalf
(
"cmd.Run() failed with %s
\n
"
,
err
)
...
...
docs/sample/call_demo.svg
0 → 100644
浏览文件 @
f2576cf4
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.43.0 (0)
-->
<!-- Title: G Pages: 1 -->
<svg
width=
"1869pt"
height=
"332pt"
viewBox=
"0.00 0.00 1868.61 332.00"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<g
id=
"graph0"
class=
"graph"
transform=
"scale(1 1) rotate(0) translate(4 328)"
>
<title>
G
</title>
<polygon
fill=
"white"
stroke=
"transparent"
points=
"-4,4 -4,-328 1864.61,-328 1864.61,4 -4,4"
/>
<!-- book.BookFactory.create -->
<g
id=
"node1"
class=
"node"
>
<title>
book.BookFactory.create
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"484.74"
cy=
"-162"
rx=
"98.84"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"484.74"
y=
"-157.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.BookFactory.create
</text>
</g>
<!-- core.IdGenerator.generate -->
<g
id=
"node2"
class=
"node"
>
<title>
core.IdGenerator.generate
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"376.74"
cy=
"-90"
rx=
"101.85"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"376.74"
y=
"-85.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
core.IdGenerator.generate
</text>
</g>
<!-- book.BookFactory.create->core.IdGenerator.generate -->
<g
id=
"edge1"
class=
"edge"
>
<title>
book.BookFactory.create
->
core.IdGenerator.generate
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M459.42,-144.59C444.9,-135.18 426.49,-123.24 410.72,-113.02"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"412.58,-110.05 402.28,-107.55 408.77,-115.93 412.58,-110.05"
/>
</g>
<!-- book.model.Book.create -->
<g
id=
"node3"
class=
"node"
>
<title>
book.model.Book.create
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"593.74"
cy=
"-90"
rx=
"96.59"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"593.74"
y=
"-85.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.model.Book.create
</text>
</g>
<!-- book.BookFactory.create->book.model.Book.create -->
<g
id=
"edge8"
class=
"edge"
>
<title>
book.BookFactory.create
->
book.model.Book.create
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M510.3,-144.59C524.95,-135.18 543.54,-123.24 559.45,-113.02"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"561.45,-115.9 567.97,-107.55 557.66,-110.01 561.45,-115.9"
/>
</g>
<!-- book.model.Book.builder -->
<g
id=
"node4"
class=
"node"
>
<title>
book.model.Book.builder
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"100.74"
cy=
"-18"
rx=
"100.99"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"100.74"
y=
"-13.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.model.Book.builder
</text>
</g>
<!-- book.model.Book.create->book.model.Book.builder -->
<g
id=
"edge2"
class=
"edge"
>
<title>
book.model.Book.create
->
book.model.Book.builder
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M523.94,-77.5C511.88,-75.6 499.46,-73.7 487.74,-72 364.44,-54.13 333.08,-53.6 209.74,-36 201.13,-34.77 192.15,-33.44 183.19,-32.09"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"183.53,-28.6 173.11,-30.56 182.47,-35.52 183.53,-28.6"
/>
</g>
<!-- book.model.Book.id -->
<g
id=
"node5"
class=
"node"
>
<title>
book.model.Book.id
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"301.74"
cy=
"-18"
rx=
"82.65"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"301.74"
y=
"-13.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.model.Book.id
</text>
</g>
<!-- book.model.Book.create->book.model.Book.id -->
<g
id=
"edge3"
class=
"edge"
>
<title>
book.model.Book.create
->
book.model.Book.id
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M536.75,-75.34C487.43,-63.51 416.18,-46.43 365.09,-34.18"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"365.69,-30.73 355.15,-31.8 364.06,-37.54 365.69,-30.73"
/>
</g>
<!-- book.model.Book.isbn -->
<g
id=
"node6"
class=
"node"
>
<title>
book.model.Book.isbn
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"492.74"
cy=
"-18"
rx=
"90.37"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"492.74"
y=
"-13.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.model.Book.isbn
</text>
</g>
<!-- book.model.Book.create->book.model.Book.isbn -->
<g
id=
"edge4"
class=
"edge"
>
<title>
book.model.Book.create
->
book.model.Book.isbn
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M569.81,-72.41C556.35,-63.08 539.37,-51.32 524.78,-41.2"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"526.72,-38.29 516.51,-35.47 522.73,-44.04 526.72,-38.29"
/>
</g>
<!-- book.model.Book.name -->
<g
id=
"node7"
class=
"node"
>
<title>
book.model.Book.name
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"695.74"
cy=
"-18"
rx=
"94.69"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"695.74"
y=
"-13.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.model.Book.name
</text>
</g>
<!-- book.model.Book.create->book.model.Book.name -->
<g
id=
"edge5"
class=
"edge"
>
<title>
book.model.Book.create
->
book.model.Book.name
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M617.92,-72.41C631.51,-63.08 648.65,-51.32 663.39,-41.2"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"665.48,-44.01 671.74,-35.47 661.52,-38.24 665.48,-44.01"
/>
</g>
<!-- book.model.Book.createdAt -->
<g
id=
"node8"
class=
"node"
>
<title>
book.model.Book.createdAt
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"918.74"
cy=
"-18"
rx=
"110.12"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"918.74"
y=
"-13.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.model.Book.createdAt
</text>
</g>
<!-- book.model.Book.create->book.model.Book.createdAt -->
<g
id=
"edge6"
class=
"edge"
>
<title>
book.model.Book.create
->
book.model.Book.createdAt
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M654.49,-75.92C708.39,-64.31 787.29,-47.31 844.84,-34.92"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"845.92,-38.27 854.96,-32.74 844.45,-31.42 845.92,-38.27"
/>
</g>
<!-- book.model.Book.build -->
<g
id=
"node9"
class=
"node"
>
<title>
book.model.Book.build
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"1140.74"
cy=
"-18"
rx=
"93.75"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"1140.74"
y=
"-13.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.model.Book.build
</text>
</g>
<!-- book.model.Book.create->book.model.Book.build -->
<g
id=
"edge7"
class=
"edge"
>
<title>
book.model.Book.create
->
book.model.Book.build
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M675.72,-80.33C764.93,-70.63 911.7,-53.92 1037.74,-36 1046,-34.83 1054.61,-33.53 1063.19,-32.18"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"1063.89,-35.61 1073.22,-30.59 1062.79,-28.7 1063.89,-35.61"
/>
</g>
<!-- book.BookService.createBook -->
<g
id=
"node10"
class=
"node"
>
<title>
book.BookService.createBook
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"1221.74"
cy=
"-234"
rx=
"118.33"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"1221.74"
y=
"-229.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.BookService.createBook
</text>
</g>
<!-- book.BookService.createBook->book.BookFactory.create -->
<g
id=
"edge9"
class=
"edge"
>
<title>
book.BookService.createBook
->
book.BookFactory.create
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M1114.66,-226.34C989.29,-217.99 775.53,-202.06 592.74,-180 583.68,-178.91 574.21,-177.62 564.8,-176.26"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"565.05,-172.76 554.65,-174.76 564.03,-179.68 565.05,-172.76"
/>
</g>
<!-- book.model.command.CreateBookCommand.getIsbn -->
<g
id=
"node11"
class=
"node"
>
<title>
book.model.command.CreateBookCommand.getIsbn
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"800.74"
cy=
"-162"
rx=
"198.97"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"800.74"
y=
"-157.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.model.command.CreateBookCommand.getIsbn
</text>
</g>
<!-- book.BookService.createBook->book.model.command.CreateBookCommand.getIsbn -->
<g
id=
"edge10"
class=
"edge"
>
<title>
book.BookService.createBook
->
book.model.command.CreateBookCommand.getIsbn
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M1145.02,-220.24C1076.58,-208.86 975.94,-192.13 901.13,-179.69"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"901.65,-176.23 891.21,-178.04 900.5,-183.13 901.65,-176.23"
/>
</g>
<!-- book.model.command.CreateBookCommand.getName -->
<g
id=
"node12"
class=
"node"
>
<title>
book.model.command.CreateBookCommand.getName
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"1221.74"
cy=
"-162"
rx=
"204.74"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"1221.74"
y=
"-157.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.model.command.CreateBookCommand.getName
</text>
</g>
<!-- book.BookService.createBook->book.model.command.CreateBookCommand.getName -->
<g
id=
"edge11"
class=
"edge"
>
<title>
book.BookService.createBook
->
book.model.command.CreateBookCommand.getName
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M1221.74,-215.7C1221.74,-207.98 1221.74,-198.71 1221.74,-190.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"1225.24,-190.1 1221.74,-180.1 1218.24,-190.1 1225.24,-190.1"
/>
</g>
<!-- book.BookRepository.save -->
<g
id=
"node13"
class=
"node"
>
<title>
book.BookRepository.save
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"1549.74"
cy=
"-162"
rx=
"105.16"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"1549.74"
y=
"-157.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.BookRepository.save
</text>
</g>
<!-- book.BookService.createBook->book.BookRepository.save -->
<g
id=
"edge13"
class=
"edge"
>
<title>
book.BookService.createBook
->
book.BookRepository.save
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M1287.33,-219C1342.09,-207.32 1420.08,-190.67 1476.8,-178.57"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"1477.73,-181.95 1486.78,-176.44 1476.27,-175.1 1477.73,-181.95"
/>
</g>
<!-- book.model.Book.getId -->
<g
id=
"node15"
class=
"node"
>
<title>
book.model.Book.getId
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"1766.74"
cy=
"-162"
rx=
"93.73"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"1766.74"
y=
"-157.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.model.Book.getId
</text>
</g>
<!-- book.BookService.createBook->book.model.Book.getId -->
<g
id=
"edge14"
class=
"edge"
>
<title>
book.BookService.createBook
->
book.model.Book.getId
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M1315.46,-222.98C1405.03,-213.11 1543.81,-197.08 1663.74,-180 1672,-178.82 1680.61,-177.52 1689.19,-176.18"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"1689.89,-179.61 1699.22,-174.58 1688.79,-172.7 1689.89,-179.61"
/>
</g>
<!-- book.BookMapper.doSave -->
<g
id=
"node14"
class=
"node"
>
<title>
book.BookMapper.doSave
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"1549.74"
cy=
"-90"
rx=
"104.36"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"1549.74"
y=
"-85.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.BookMapper.doSave
</text>
</g>
<!-- book.BookRepository.save->book.BookMapper.doSave -->
<g
id=
"edge12"
class=
"edge"
>
<title>
book.BookRepository.save
->
book.BookMapper.doSave
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M1549.74,-143.7C1549.74,-135.98 1549.74,-126.71 1549.74,-118.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"1553.24,-118.1 1549.74,-108.1 1546.24,-118.1 1553.24,-118.1"
/>
</g>
<!-- book.BookController.createBook -->
<g
id=
"node16"
class=
"node"
>
<title>
book.BookController.createBook
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"1221.74"
cy=
"-306"
rx=
"127.52"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"1221.74"
y=
"-301.8"
font-family=
"Times,serif"
font-size=
"14.00"
>
book.BookController.createBook
</text>
</g>
<!-- book.BookController.createBook->book.BookService.createBook -->
<g
id=
"edge15"
class=
"edge"
>
<title>
book.BookController.createBook
->
book.BookService.createBook
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M1221.74,-287.7C1221.74,-279.98 1221.74,-270.71 1221.74,-262.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"1225.24,-262.1 1221.74,-252.1 1218.24,-262.1 1225.24,-262.1"
/>
</g>
</g>
</svg>
src/domain/call_graph.go
浏览文件 @
f2576cf4
...
...
@@ -35,7 +35,6 @@ func BuildCallChain(funcName string, methodMap map[string][]string) string {
arrayResult
=
arrayResult
+
BuildCallChain
(
child
,
methodMap
)
}
arrayResult
=
arrayResult
+
"
\"
"
+
funcName
+
"
\"
->
\"
"
+
child
+
"
\"
;
\n
"
}
return
arrayResult
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录