未验证 提交 235f2c89 编写于 作者: P Phodal Huang

feat: add arch demo

上级 4080cd7d
...@@ -70,12 +70,27 @@ Available Commands: ...@@ -70,12 +70,27 @@ Available Commands:
``` ```
1. Run `coca analysis`
2. Run Command
### Analysis ### Analysis
``` ```
coca analysis coca analysis
``` ```
### Arch
```
coca arch
```
Examples Results:
![Architecture demo](docs/sample/arch.svg)
Repo from: [https://github.com/howiehu/ddd-architecture-samples](https://github.com/howiehu/ddd-architecture-samples)
### Find Bad Smells ### Find Bad Smells
```bash ```bash
......
...@@ -30,8 +30,6 @@ var archCmd = &cobra.Command{ ...@@ -30,8 +30,6 @@ var archCmd = &cobra.Command{
archApp := arch.NewArchApp() archApp := arch.NewArchApp()
dotContent := archApp.Analysis(parsedDeps, identifiersMap) dotContent := archApp.Analysis(parsedDeps, identifiersMap)
fmt.Println(dotContent)
ignores := strings.Split("", ",") ignores := strings.Split("", ",")
var nodeFilter = func(key string) bool { var nodeFilter = func(key string) bool {
for _, f := range ignores { for _, f := range ignores {
......
...@@ -66,6 +66,10 @@ func addCallInMethod(clz models.JClassNode, identifiersMap map[string]models.JId ...@@ -66,6 +66,10 @@ func addCallInMethod(clz models.JClassNode, identifiersMap map[string]models.JId
// TODO: add implements, extends support // TODO: add implements, extends support
for _, call := range method.MethodCalls { for _, call := range method.MethodCalls {
dst := call.Package + "." + call.Class dst := call.Package + "." + call.Class
if src == dst {
continue
}
if _, ok := identifiersMap[dst]; ok { if _, ok := identifiersMap[dst]; ok {
relation := &tequila.Relation{ relation := &tequila.Relation{
From: src, From: src,
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册