Giter VIP home page Giter VIP logo

phodal / coca Goto Github PK

View Code? Open in Web Editor NEW
936.0 26.0 108.0 5.23 MB

Coca is a toolbox which is design for legacy system refactoring and analysis, includes call graph, concept analysis, api tree, design patterns suggest. Coca 是一个用于系统重构、系统迁移和系统分析的工具箱。它可以分析代码中的测试坏味道、模块化分析、行数统计、分析调用与依赖、Git 分析以及自动化重构等。

Home Page: https://coca.migration.ink/

License: Mozilla Public License 2.0

Go 51.95% ANTLR 23.86% Shell 0.19% Makefile 0.27% Java 16.38% TypeScript 5.92% Python 0.10% C++ 1.34% Kotlin 0.01%
refactor refactoring architecture tools ai git automation

coca's Introduction

Coca - toolbox for system refactoring and analysis

GitHub release (latest SemVer) Maintainability codecov GitHub go.mod Go version Build

Coca is a toolbox which is design for legacy system refactoring and analysis, includes call graph, concept analysis, api tree, design patterns suggest. Coca 是一个用于系统重构、系统迁移和系统分析的工具箱。它可以分析代码中的测试坏味道、模块化分析、行数统计、分析调用与依赖、Git 分析以及自动化重构等。

Related Tools: Coco is an effective DevOps analysis and auto-suggest tool.

Kotlin version: Chapi

Migration Guide (Chinese Version): 《系统重构与迁移指南

Inspired by: newlee & Tequila

Refactoring Modeling:

Refactoring Modeling

  • Languages Support: Java (full features)

Features List:

Available Commands:
  analysis    analysis code
  api         scan HTTP api from annotation
  arch        project package visualization
  bs          generate bad smell list and suggestions
  call        show call graph with specific method
  cloc        count lines of code with complexity estimation
  concept     build domain concept from source code
  count       count most refs function
  evaluate    evaluate code situation and refactor effort
  git         analysis git commit history for revs count, summary and suggest
  help        Help about any command
  rcall       reverse call graph visualization
  refactor    auto refactor code
  suggest     find usable Design Patterns from code
  tbs         generate tests bad smell
  todo        scan all todo, and list with time
  version     version

Getting started

Requirements: graphviz for dot file to image (such as svg, png)

The easiest way to get coca is to use one of the pre-built release binaries which are available for OSX, Linux, Windows on the release page.

You can also install yourself :

go install github.com/modernizing/coca@latest

Usage

Analysis

coca analysis

Arch

coca arch

Android Studio Gradle DSL Module (merge header)

command: coca arch -x "com.android.tools.idea.gradle.dsl" -H true

Gradle Demo

Android Studio Gradle DSL Module Elements Part:

command: coca arch -x "com.android.tools.idea.gradle.dsl.parser.elements"

Gradle Demo

Find Bad Smells

coca bs -s type

Examples Result:

{
   "dataClass": [
      {
         "File": "examples/api/BookController.java",
         "BS": "dataClass"
      }
   ],
   "lazyElement": [
      {
         "File": "examples/api/model/BookRepresentaion.java",
         "BS": "lazyElement"
      }
   ]
}

Code Line Count

coca cloc

Results:

───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
Go                          58     31763     7132       890    23741       2847
Java                        44       971      208        21      742         62
Markdown                     8       238       75         0      163          0
Gherkin Specificati…         2        32        2        16       14          0
Document Type Defin…         1       293       36         0      257          0
License                      1       201       32         0      169          0
SQL                          1         2        0         0        2          0
SVG                          1       199        0        34      165          0
Shell                        1         3        1         1        1          0
XML                          1        13        0         0       13          0
gitignore                    1        61        8         4       49          0
───────────────────────────────────────────────────────────────────────────────
Total                      119     33776     7494       966    25316       2909
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop $803,822
Estimated Schedule Effort 14.120551 months
Estimated People Required 6.743156
───────────────────────────────────────────────────────────────────────────────

Results to json

coca cloc --by-file --format json

Cloc by directory

coca cloc ~/intellij-community/android/ --by-directory --include-ext=java,kt --not-match=".*(Test|Tests)\.(kt|java)"

results csv:

module,summary
adt-branding,169
adt-testutils,257
adt-ui,21987
adt-ui-model,3450
android,361270
android-adb,497
android-common,3280
android-debuggers,3030
android-kotlin,8816
android-lang,24796
android-lang-databinding,6392
android-layout-inspector,2533
...

Cloc Top File

coca cloc ~/intellij-community/android/designer/src/com/android/tools/idea --top-file --top-size 10

output to: coca_reporter/sort_cloc.json and also:

| LENGTH | COMPLEXITY |             LOCATION              |
|--------|------------|-----------------------------------|
|   1642 |        236 | ConstraintLayoutHandler.java      |
|   1492 |        375 | ConstraintComponentUtilities.java |
|   1189 |        166 | CommonActions.java                |
|   1184 |        325 | ConstraintWidget.java             |
|   1169 |        129 | SingleWidgetView.java             |
|   1115 |        213 | ScoutArrange.java                 |
|   1097 |        281 | ScoutWidget.java                  |
|   1081 |        224 | 3d/Rasterize.java                 |
|   1016 |        159 | LayoutlibSceneManager.java        |
|   1014 |        220 | TimeLinePanel.java                |

Build Deps Tree

coca call -c com.phodal.pholedge.book.BookController.createBook -r com.phodal.pholedge.

Examples Results:

Call Demo

Identify Spring API

coca api -f

API Demo

With Count

coca api -r com.phodal.pholedge. -c 

or multi package:

coca api -r com.macro.mall.demo.controller.,com.zheng.cms.admin.,com.phodal.pholedge -c

+------+--------+------------------------------------------------+------------------------------------------------------------------------+
| SIZE | METHOD |                      URI                       |                                 CALLER                                 |
+------+--------+------------------------------------------------+------------------------------------------------------------------------+
|   36 | GET    | /aliyun/oss/policy                             | controller.OssController.policy                                        |
|   21 | POST   | /aliyun/osscallback                            | controller.OssController.callback                                      |
|   17 | GET    | /subject/list                                  | controller.CmsSubjectController.getList                                |
|   17 | GET    | /esProduct/search                              | search.controller.EsProductController.search                           |
|   17 | GET    | /order/list                                    | controller.OmsOrderController.list                                     |
|   17 | GET    | /productAttribute/list/{cid}                   | controller.PmsProductAttributeController.getList                       |
|   17 | GET    | /productCategory/list/{parentId}               | controller.PmsProductCategoryController.getList                        |
|   17 | GET    | /brand/list                                    | controller.PmsBrandController.getList                                  |
|   17 | GET    | /esProduct/search/simple                       | search.controller.EsProductController.search                           |
+------+--------+------------------------------------------------+------------------------------------------------------------------------+

Git Analysis

coca git -t

Results:

+---------------------------------------------------------------------------------------------------------------------+-----------+-------------+
|                                                     ENTITYNAME                                                      | REVSCOUNT | AUTHORCOUNT |
+---------------------------------------------------------------------------------------------------------------------+-----------+-------------+
| build.gradle                                                                                                        |      1326 |          36 |
| src/asciidoc/index.adoc                                                                                             |       239 |          20 |
| build-spring-framework/resources/changelog.txt                                                                      |       187 |          10 |
| spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java                                  |       170 |          10 |
| spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java                |       159 |          15 |
| src/docs/asciidoc/web/webmvc.adoc                                                                                   |       121 |          24 |
| spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java                   |       118 |           9 |
| src/dist/changelog.txt                                                                                              |       118 |           9 |
| spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java       |       116 |          15 |
| spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java        |       113 |          15 |
| spring-web/src/main/java/org/springframework/http/HttpHeaders.java                                                  |       111 |          18 |
| src/docs/asciidoc/web/webflux.adoc                                                                                  |       108 |          21 |
| spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java                            |       107 |           9 |
| spring-test/spring-test.gradle                                                                                      |       105 |           7 |
| spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java |       105 |          13 |
| spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java         |       101 |          12 |
| spring-web/src/main/java/org/springframework/web/client/RestTemplate.java                                           |        98 |          17 |
| spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java                |        96 |          14 |
| org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java                         |        93 |           4 |
| spring-core/src/main/java/org/springframework/core/ResolvableType.java                                              |        92 |          10 |
+---------------------------------------------------------------------------------------------------------------------+-----------+-------------+

Concept Analyser

coca concept

Results Examples:

+------------------+--------+
|      WORDS       | COUNTS |
+------------------+--------+
| context          |    590 |
| resolve          |    531 |
| path             |    501 |
| content          |    423 |
| code             |    416 |
| resource         |    373 |
| property         |    372 |
| session          |    364 |
| attribute        |    349 |
| properties       |    343 |
| headers          |    330 |
+------------------+--------+

Count Refs

coca count

Results:

+------------+--------------------------------------------------------------------------+
| REFS COUNT |                                  METHOD                                  |
+------------+--------------------------------------------------------------------------+
|          2 | com.phodal.pholedge.book.BookRepository.byId                             |
|          2 | com.phodal.pholedge.book.model.Book.toRepresentation                     |
|          2 | com.phodal.pholedge.book.BookRepository.save                             |
|          2 | com.phodal.coca.analysis.JavaCallApp.parse                               |
|          2 | com.phodal.pholedge.book.BookRepository.save                             |
|          2 | com.phodal.coca.analysis.JavaCallApp.parse                               |
|          1 | com.phodal.pholedge.book.model.Book.save                                 |
|          1 | evolution.analysis.jv.calls.JavaCallVisitor.parseNewType                 |
|          1 | evolution.analysis.jv.calls.JavaCallVisitor.isNotSpecialNewWord          |
|          1 | com.phodal.pholedge.book.BookMapper.byId                                 |
|          1 | com.phodal.pholedge.book.BookService.updateBook                          |
|          1 | com.phodal.pholedge.book.BookService.getBooksLists                       |
|          1 | com.phodal.pholedge.book.BookService.getBookById                         |
|          1 | com.phodal.pholedge.book.BookMapper.doSave                               |
|          1 | com.phodal.pholedge.book.BookMapper.list                                 |
|          1 | com.phodal.pholedge.book.BookService.createBook                          |
|          1 | com.phodal.pholedge.book.BookFactory.create                              |
|          1 | com.phodal.pholedge.book.BookRepository.list                             |
|          1 | com.phodal.pholedge.book.model.Book.create                               |
+------------+--------------------------------------------------------------------------+

Reverse Call Graph

coca rcall -c org.bytedeco.javacpp.tools.TokenIndexer.get

Results:

digraph G { 
edge [dir="back"];

"org.bytedeco.javacpp.tools.Parser.extern" -> "org.bytedeco.javacpp.tools.Parser.declarations";
"org.bytedeco.javacpp.tools.Parser.declarations" -> "org.bytedeco.javacpp.tools.Parser.extern";
...
}

RCall Demo

Auto Refactor

support:

  • rename
  • move
  • remove unused import
  • remove unused class
coca refactor -R rename.coca -p src/main
coca refactor -m move.config -p .

Evaluate

coca evaluate

Arduino Results(Old Version):

+--------------------------------+-------+-----------------------+-------+-----------+
|              TYPE              | COUNT |         LEVEL         | TOTAL |   RATE    |
+--------------------------------+-------+-----------------------+-------+-----------+
| Nullable / Return Null         |     0 | Method                |  1615 | 0.00%     |
| Utils                          |     7 | Class                 |   252 | 2.78%     |
| Static Method                  |     0 | Method                |  1615 | 0.43%     |
| Average Method Num.            |  1615 | Method/Class          |   252 |  6.408730 |
| Method Num. Std Dev / 标准差   |  1615 | Class                 | -     |  7.344917 |
| Average Method Length          | 13654 | Without Getter/Setter |  1100 | 12.412727 |
| Method Length Std Dev / 标准差 |  1615 | Method                | -     | 20.047092 |
+--------------------------------+-------+-----------------------+-------+-----------+

New Version:

|              TYPE              | TYPE COUNT |         LEVEL         | LEVEL TOTAL | VALUE = COUNT / TOTAL |
|--------------------------------|------------|-----------------------|-------------|-----------------------|
| Nullable / Return Null         |          0 | Method                |           6 | 0.00%                 |
| Utils                          |          0 | Class                 |          14 | 0.00%                 |
| Static Method                  |          1 | Method                |           6 | 0.00%                 |
| Average Method Num.            |          6 | Method/Class          |          14 |              0.428571 |
| Method Num. Std Dev / 标准差   |          6 | Class                 | -           |              0.646206 |
| Average Method Length          |          0 | Without Getter/Setter |           0 | NaN                   |
| Method Length Std Dev / 标准差 |          0 | Method                | -           | NaN                   |

Evaluate.json examples

{
	"Nullable": {
		"Items": [
			"nonnull.Name.testNull",
			"nonnull.Name.orElseNull",
			"org.ofbiz.base.util.UtilURL.fromResource",
			"org.ofbiz.base.util.UtilURL.getOfbizHomeRelativeLocationFromFilePath",
			"study.huhao.demo.adapters.outbound.persistence.blog.BlogPO.toDomainModel",
			"study.huhao.demo.adapters.outbound.persistence.blog.BlogPO.toDomainModel",
			"study.huhao.demo.adapters.outbound.persistence.blog.BlogPO.of",
			"study.huhao.demo.infrastructure.persistence.blog.BlogPO.convertDomain"
		]
	},
	"ServiceSummary": {
		"LifecycleMap": null,
		"ReturnTypeMap": {
			"BookRepresentaion": [
				"com.phodal.pholedge.book.BookService.getBookById",
				"com.phodal.pholedge.book.BookService.updateBook"
			]
		},
		"RelatedMethod": null
	},
	"UtilsSummary": {},
	"Summary": {
		"UtilsCount": 1,
		"ClassCount": 64,
		"MethodCount": 161,
		"StaticMethodCount": 19
	}
}

Todo

coca todo

results:

+------------+-----------------+--------------------------------+--------------------------------------------------------------------------------------+------+
|    DATE    |     AUTHOR      |            MESSAGES            |                                       FILENAME                                       | LINE |
+------------+-----------------+--------------------------------+--------------------------------------------------------------------------------------+------+
| 2019-12-09 | Cristian Maglie | happens on macosx, don't know  | app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellJPanel.java |  118 |
|            |                 | why                            |                                                                                      |      |
| 2019-12-09 | Cristian Maglie | Make this a method of Theme    | app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellJPanel.java |  233 |
| 2019-12-09 | Cristian Maglie | Do a better job in refreshing  | app/src/cc/arduino/contributions/libraries/ui/LibraryManagerUI.java                  |  241 |
|            |                 | only the needed element        |                                                                                      |      |
| 2019-12-09 | Cristian Maglie | Do a better job in refreshing  | app/src/cc/arduino/contributions/libraries/ui/LibraryManagerUI.java                  |  273 |
|            |                 | only the needed element        |                                                                                      |      |
| 2019-12-09 | Cristian Maglie | Make this a method of Theme    | app/src/cc/arduino/contributions/libraries/ui/MultiLibraryInstallDialog.java         |  149 |
| 2019-12-09 | Cristian Maglie | happens on macosx, don't know  | app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellJPanel.java |  183 |
|            |                 | why                            |                                                                                      |      |
| 2019-12-09 | Cristian Maglie | show error                     | app/src/processing/app/Base.java                                                     | 1440 |
| 2019-12-09 | Cristian Maglie | error when importing. ignoring | app/src/processing/app/Base.java                                                     | 2423 |
|            |                 | :(                             |                                                                                      |      |
| 2019-12-09 | Cristian Maglie | Improve / move error handling  | app/src/processing/app/Editor.java                                                   | 1541 |
| 2019-12-09 | Cristian Maglie | Should be a Theme value?       | app/src/processing/app/EditorHeader.java                                             |   78 |
| 2019-12-09 | Cristian Maglie | Should be a Theme value?       | app/src/processing/app/EditorStatus.java                                             |   73 |
| 2019-12-09 | Cristian Maglie | Improve decoupling             | app/src/processing/app/EditorTab.java                                                |  465 |
+------------+-----------------+--------------------------------+--------------------------------------------------------------------------------------+------+```

Suggest

coca suggest

results:

+--------+------------------+--------------------------------+
| CLASS  |     PATTERN      |             REASON             |
+--------+------------------+--------------------------------+
| Insect | factory          | too many constructor           |
| Bee    | factory, builder | complex constructor, too       |
|        |                  | many constructor, too many     |
|        |                  | parameters                     |
+--------+------------------+--------------------------------+

Test Bad Smells

coca tbs

results

+---------------------+---------------------------------------------------------------+------+
|        TYPE         |                           FILENAME                            | LINE |
+---------------------+---------------------------------------------------------------+------+
| DuplicateAssertTest | app/test/cc/arduino/i18n/ExternalProcessOutputParserTest.java |  107 |
| DuplicateAssertTest | app/test/cc/arduino/i18n/ExternalProcessOutputParserTest.java |   41 |
| DuplicateAssertTest | app/test/cc/arduino/i18n/ExternalProcessOutputParserTest.java |   63 |
| RedundantPrintTest  | app/test/cc/arduino/i18n/I18NTest.java                        |   71 |
| RedundantPrintTest  | app/test/cc/arduino/i18n/I18NTest.java                        |   72 |
| RedundantPrintTest  | app/test/cc/arduino/i18n/I18NTest.java                        |   77 |
| DuplicateAssertTest | app/test/cc/arduino/net/PACSupportMethodsTest.java            |   19 |
| DuplicateAssertTest | app/test/processing/app/macosx/SystemProfilerParserTest.java  |   51 |
| DuplicateAssertTest | app/test/processing/app/syntax/PdeKeywordsTest.java           |   41 |
| DuplicateAssertTest | app/test/processing/app/tools/ZipDeflaterTest.java            |   57 |
| DuplicateAssertTest | app/test/processing/app/tools/ZipDeflaterTest.java            |   83 |
| DuplicateAssertTest | app/test/processing/app/tools/ZipDeflaterTest.java            |  109 |
+---------------------+---------------------------------------------------------------+------+

Find unused deps

coca deps -p _fixtures/deps/maven_sample

results:

+---------------------------+----------------------------------------+---------+
|          GROUPID          |               ARTIFACTID               |  SCOPE  |
+---------------------------+----------------------------------------+---------+
| org.flywaydb              | flyway-core                            |         |
| mysql                     | mysql-connector-java                   | runtime |
| org.springframework.cloud | spring-cloud-starter-contract-verifier | test    |
+---------------------------+----------------------------------------+---------+

Showcases

Android Studio Analysis Examples. Call with lookup: coca call -l

Call Examples

Roadmap

  • bad smell support
    • sort method size
    • type
      • longParameterList
      • longMethod
      • repeatedSwitches
      • complexIf
      • largeClass
      • refusedBequest
      • dataClass
  • CLOC
  • HTTP API Visualization
    • Spring Support
    • @Service Support
    • API Call Size
  • Git
  • Concept
    • words NLP
    • to domain
  • Call & rcall graph
    • Count Refs
  • AutoRefactor
    • remove unused
    • move files
  • Evaluate
    • nullable count
    • static count
    • method num /length count
  • Todo Summary
    • Todo with History & Author
  • Suggest API for Design Patterns
    • factory pattern
    • strategy
    • builder
    • cycle-deps -> adapter / agency
    • bad patterns
      • singleton
  • Evaluate API
    • Average Method Length
    • Average Class Method Count
  • Tests
    • Testable?
    • Test badsmell -> list [https://testsmells.github.io/pages/testsmells.html]
      • IgnoreTest: @Ingore
      • EmptyTest: not call in test
      • RedundantPrintTest: system.out.println
      • SleepyTest: Time.sleep
      • RedundantAssertionTest: assertTrue(True)
      • UnknownTest: not assert
      • DuplicateAssertTest: assert > 5
      • TestersOnly: method only call by test
      • CrossBorderTest: test method which not in system
      • General Fixture: JUnit classes having at least one method not using the entire test fixture defined in the setUp() method
  • Arch
    • Architecture Visualization
    • Architecture Guard
      • DSL Design
  • Tech Debt from Source Code
    • auto create story
  • TBD
  • Online Code Analysis
    • WASM support
    • expose WASM API
    • GitHub search code
  • Pluggable
    • plugin support (Windows Issues)
  • Dependence Analysis
    • Deps Related Counts
    • 3rd-party analysis XML or Groovy Scripts
    • Groovy Support
      • migrate to Golang Styles
  • Story Cmd
    • Auto create refactor story
  • Clean Code Suggest
  • More CodeSmells

Documents Todo:

  • Docs
    • Lifecycle for new projects: evaluate (cloc, bad smell, api, git, todo) -> design -> patterns (suggest) -> refactoring ()
  • Date Collections
    • monolithic
    • microservice
    • big data

Tech Debt

  • Test for Windows
  • Duplicate Code
    • cmd/ -> user builder to refactoring

Dev

Install Go

brew install go

Env

export GOROOT=/usr/local/opt/go/libexec
export GOPATH=$HOME/.go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

clone

git clone https://github.com/modernizing/coca

Test Frameworks

go get github.com/onsi/ginkgo
go get github.com/onsi/gomega

License

Arch based on Tequila

Git Analysis inspired by Code Maat

Test bad smells inspired by Test Smell Examples

Phodal's Idea

@ 2019 A Phodal Huang's Idea. This code is distributed under the MPL license. See LICENSE in this directory.

coca's People

Contributors

huld2010 avatar phodal avatar syheliel avatar wuwen5 avatar xiaozhiliaoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coca's Issues

VirtualAlloc of 23817117696 bytes failed with errno=1455

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

命令行安装失败

MacBookPro coca % go get -u github.com/phodal/coca
go: golang.org/x/text upgrade => v0.3.3
go: github.com/mattn/go-runewidth upgrade => v0.0.9
go: github.com/spf13/pflag upgrade => v1.0.5
go: gonum.org/v1/gonum upgrade => v0.7.0
go: gopkg.in/yaml.v2 upgrade => v2.3.0
MacBookPro coca % coca
zsh: command not found: coca

Found install issue

Hello, I tried to install this software and found the report like this:

$ go get -u github.com/phodal/coca
# github.com/yourbasic/radix
gocode/src/github.com/yourbasic/radix/sort.go:69: undefined: reflect.Swapper
# github.com/phodal/coca/pkg/domain/api_domain
gocode/src/github.com/phodal/coca/pkg/domain/api_domain/call_api.go:13: undefined: sort.Slice
# github.com/awalterschulze/gographviz/internal/errors
gocode/src/github.com/awalterschulze/gographviz/internal/errors/errors.go:24: undefined: strings.Builder
gocode/src/github.com/awalterschulze/gographviz/internal/errors/errors.go:45: undefined: strings.Builder
# gonum.org/v1/gonum/internal/asm/f64
gocode/src/gonum.org/v1/gonum/internal/asm/f64/gemvN_amd64.s:241: unrecognized instruction "MOVDDUP"
gocode/src/gonum.org/v1/gonum/internal/asm/f64/gemvN_amd64.s:242: unrecognized instruction "MOVDDUP"
gocode/src/gonum.org/v1/gonum/internal/asm/f64/gemvN_amd64.s:382: unrecognized instruction "MOVDDUP"
gocode/src/gonum.org/v1/gonum/internal/asm/f64/gemvN_amd64.s:443: unrecognized instruction "MOVDDUP"
gocode/src/gonum.org/v1/gonum/internal/asm/f64/gemvN_amd64.s:563: unrecognized instruction "MOVDDUP"
gocode/src/gonum.org/v1/gonum/internal/asm/f64/gemvN_amd64.s:623: unrecognized instruction "MOVDDUP"
asm: asm: assembly of gocode/src/gonum.org/v1/gonum/internal/asm/f64/gemvN_amd64.s failed
# gonum.org/v1/gonum/internal/asm/f32
gocode/src/gonum.org/v1/gonum/internal/asm/f32/ge_amd64.s:384: unrecognized instruction "MOVDDUP"
gocode/src/gonum.org/v1/gonum/internal/asm/f32/ge_amd64.s:447: unrecognized instruction "MOVDDUP"
asm: asm: assembly of gocode/src/gonum.org/v1/gonum/internal/asm/f32/ge_amd64.s failed
# github.com/boyter/scc/processor
gocode/src/github.com/boyter/scc/processor/detector.go:190: undefined: sort.Slice
gocode/src/github.com/boyter/scc/processor/file.go:17: undefined: sync.Map
gocode/src/github.com/boyter/scc/processor/formatters.go:41: undefined: sort.Slice
gocode/src/github.com/boyter/scc/processor/formatters.go:45: undefined: sort.Slice
gocode/src/github.com/boyter/scc/processor/formatters.go:49: undefined: sort.Slice
gocode/src/github.com/boyter/scc/processor/formatters.go:53: undefined: sort.Slice
gocode/src/github.com/boyter/scc/processor/formatters.go:57: undefined: sort.Slice
gocode/src/github.com/boyter/scc/processor/formatters.go:61: undefined: sort.Slice
gocode/src/github.com/boyter/scc/processor/formatters.go:65: undefined: sort.Slice
gocode/src/github.com/boyter/scc/processor/formatters.go:706: undefined: strings.Builder
gocode/src/github.com/boyter/scc/processor/formatters.go:65: too many errors
# github.com/phodal/coca/pkg/application/todo/astitodo
gocode/src/github.com/phodal/coca/pkg/application/todo/astitodo/astitodo.go:63: undefined: strings.ReplaceAll
gocode/src/github.com/phodal/coca/pkg/application/todo/astitodo/astitodo.go:64: undefined: strings.ReplaceAll
gocode/src/github.com/phodal/coca/pkg/application/todo/astitodo/astitodo.go:65: undefined: strings.ReplaceAll

My laptop is ubuntu 16.04, and haven't used go launguage before, just installed it today.

cmd dot not found

os: window10
coca's branch: master

exceptions from console output:
cmd.Run() failed with: exec: "dot": executable file not found in %PATH%, what's the matter, please help me

go项目 用不了

coca analysis
显示stat : no such file or directory
coca analysis + 项目文件夹 直接panic了,

fatal error: runtime: out of memory

runtime stack:
runtime.throw(0xcaf6bb, 0x16)
	/usr/local/go/src/runtime/panic.go:774 +0x72
runtime.sysMap(0xc244000000, 0x230000000, 0x15d5bd8)
	/usr/local/go/src/runtime/mem_linux.go:169 +0xc5
runtime.(*mheap).sysAlloc(0x15abc40, 0x22c1b8000, 0x7f46667fbca8, 0x4366c7)
	/usr/local/go/src/runtime/malloc.go:701 +0x1cd
runtime.(*mheap).grow(0x15abc40, 0x1160dc, 0x7f46ffffffff)
	/usr/local/go/src/runtime/mheap.go:1255 +0xa3
runtime.(*mheap).allocSpanLocked(0x15abc40, 0x1160dc, 0x15d5be8, 0x7f46667fbde8)
	/usr/local/go/src/runtime/mheap.go:1170 +0x266
runtime.(*mheap).alloc_m(0x15abc40, 0x1160dc, 0x101, 0x186a0)
	/usr/local/go/src/runtime/mheap.go:1022 +0xc2
runtime.(*mheap).alloc.func1()
	/usr/local/go/src/runtime/mheap.go:1093 +0x4c
runtime.(*mheap).alloc(0x15abc40, 0x1160dc, 0xc000010101, 0xc000000180)
	/usr/local/go/src/runtime/mheap.go:1092 +0x8a
runtime.largeAlloc(0x22c1b6abd, 0xc000470101, 0x200000001)
	/usr/local/go/src/runtime/malloc.go:1138 +0x97
runtime.mallocgc.func1()
	/usr/local/go/src/runtime/malloc.go:1033 +0x46
runtime.systemstack(0xc00008e480)
	/usr/local/go/src/runtime/asm_amd64.s:370 +0x66
runtime.mstart()
	/usr/local/go/src/runtime/proc.go:1146

goroutine 1 [running]:
runtime.systemstack_switch()
	/usr/local/go/src/runtime/asm_amd64.s:330 fp=0xc002f6a0d0 sp=0xc002f6a0c8 pc=0x458c90
runtime.mallocgc(0x22c1b6abd, 0xb6b500, 0x476401, 0xc0005b78a8)
	/usr/local/go/src/runtime/malloc.go:1032 +0x895 fp=0xc002f6a170 sp=0xc002f6a0d0 pc=0x40d1d5
runtime.makeslice(0xb6b500, 0x22c1b6abd, 0x22c1b6abd, 0xc0005b78a8)
	/usr/local/go/src/runtime/slice.go:49 +0x6c fp=0xc002f6a1a0 sp=0xc002f6a170 pc=0x443d9c
bytes.makeSlice(0x22c1b6abd, 0x0, 0x0, 0x0)
	/usr/local/go/src/bytes/buffer.go:229 +0x77 fp=0xc002f6a208 sp=0xc002f6a1a0 pc=0x4edb47
bytes.(*Buffer).grow(0xc0005b7880, 0x13, 0x2)
	/usr/local/go/src/bytes/buffer.go:142 +0x15b fp=0xc002f6a258 sp=0xc002f6a208 pc=0x4ed48b
bytes.(*Buffer).WriteString(0xc0005b7880, 0xc0000d0e20, 0x13, 0x0, 0xb6a800, 0xc00335aa70)
	/usr/local/go/src/bytes/buffer.go:184 +0xdd fp=0xc002f6a288 sp=0xc002f6a258 pc=0x4ed8ad
encoding/json.structEncoder.encode(0xc00042a900, 0x9, 0x10, 0xc0003a6c90, 0xc0005b7880, 0xbecec0, 0xc00335aa00, 0x199, 0x100)
	/usr/local/go/src/encoding/json/encode.go:659 +0x2a7 fp=0xc002f6a328 sp=0xc002f6a288 pc=0x4fcfc7
encoding/json.structEncoder.encode-fm(0xc0005b7880, 0xbecec0, 0xc00335aa00, 0x199, 0xbe0100)
	/usr/local/go/src/encoding/json/encode.go:635 +0x7f fp=0xc002f6a380 sp=0xc002f6a328 pc=0x50897f
encoding/json.arrayEncoder.encode(0xc0003a6cf0, 0xc0005b7880, 0xb55680, 0xc002a79b40, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:791 +0xd6 fp=0xc002f6a3d8 sp=0xc002f6a380 pc=0x4fe2e6
encoding/json.arrayEncoder.encode-fm(0xc0005b7880, 0xb55680, 0xc002a79b40, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:784 +0x64 fp=0xc002f6a418 sp=0xc002f6a3d8 pc=0x508b04
encoding/json.sliceEncoder.encode(0xc00039ab90, 0xc0005b7880, 0xb55680, 0xc002a79b40, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:765 +0x8f fp=0xc002f6a460 sp=0xc002f6a418 pc=0x4fdf4f
encoding/json.sliceEncoder.encode-fm(0xc0005b7880, 0xb55680, 0xc002a79b40, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:760 +0x64 fp=0xc002f6a4a0 sp=0xc002f6a460 pc=0x508a84
encoding/json.structEncoder.encode(0xc00042a000, 0xe, 0x10, 0xc0003a7110, 0xc0005b7880, 0xc0bd80, 0xc002a79ae8, 0x199, 0x100)
	/usr/local/go/src/encoding/json/encode.go:664 +0x306 fp=0xc002f6a540 sp=0xc002f6a4a0 pc=0x4fd026
encoding/json.structEncoder.encode-fm(0xc0005b7880, 0xc0bd80, 0xc002a79ae8, 0x199, 0xc00100)
	/usr/local/go/src/encoding/json/encode.go:635 +0x7f fp=0xc002f6a598 sp=0xc002f6a540 pc=0x50897f
encoding/json.arrayEncoder.encode(0xc0003a7140, 0xc0005b7880, 0xb55640, 0xc0025f1c38, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:791 +0xd6 fp=0xc002f6a5f0 sp=0xc002f6a598 pc=0x4fe2e6
encoding/json.arrayEncoder.encode-fm(0xc0005b7880, 0xb55640, 0xc0025f1c38, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:784 +0x64 fp=0xc002f6a630 sp=0xc002f6a5f0 pc=0x508b04
encoding/json.sliceEncoder.encode(0xc00039aeb0, 0xc0005b7880, 0xb55640, 0xc0025f1c38, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:765 +0x8f fp=0xc002f6a678 sp=0xc002f6a630 pc=0x4fdf4f
encoding/json.sliceEncoder.encode-fm(0xc0005b7880, 0xb55640, 0xc0025f1c38, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:760 +0x64 fp=0xc002f6a6b8 sp=0xc002f6a678 pc=0x508a84
encoding/json.typeEncoder.func1(0xc0005b7880, 0xb55640, 0xc0025f1c38, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:374 +0x79 fp=0xc002f6a6f8 sp=0xc002f6a6b8 pc=0x507d59
encoding/json.structEncoder.encode(0xc00042b200, 0xc, 0x10, 0xc0003a70b0, 0xc0005b7880, 0xc080e0, 0xc0025f1be0, 0x199, 0x100)
	/usr/local/go/src/encoding/json/encode.go:664 +0x306 fp=0xc002f6a798 sp=0xc002f6a6f8 pc=0x4fd026
encoding/json.structEncoder.encode-fm(0xc0005b7880, 0xc080e0, 0xc0025f1be0, 0x199, 0xc00100)
	/usr/local/go/src/encoding/json/encode.go:635 +0x7f fp=0xc002f6a7f0 sp=0xc002f6a798 pc=0x50897f
encoding/json.arrayEncoder.encode(0xc0003a70e0, 0xc0005b7880, 0xb55540, 0xc0025f1da0, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:791 +0xd6 fp=0xc002f6a848 sp=0xc002f6a7f0 pc=0x4fe2e6
encoding/json.arrayEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc0025f1da0, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:784 +0x64 fp=0xc002f6a888 sp=0xc002f6a848 pc=0x508b04
encoding/json.sliceEncoder.encode(0xc00039ae60, 0xc0005b7880, 0xb55540, 0xc0025f1da0, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:765 +0x8f fp=0xc002f6a8d0 sp=0xc002f6a888 pc=0x4fdf4f
encoding/json.sliceEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc0025f1da0, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:760 +0x64 fp=0xc002f6a910 sp=0xc002f6a8d0 pc=0x508a84
encoding/json.typeEncoder.func1(0xc0005b7880, 0xb55540, 0xc0025f1da0, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:374 +0x79 fp=0xc002f6a950 sp=0xc002f6a910 pc=0x507d59
encoding/json.structEncoder.encode(0xc00042b200, 0xc, 0x10, 0xc0003a70b0, 0xc0005b7880, 0xc080e0, 0xc0025f1cd8, 0x199, 0x100)
	/usr/local/go/src/encoding/json/encode.go:664 +0x306 fp=0xc002f6a9f0 sp=0xc002f6a950 pc=0x4fd026
encoding/json.structEncoder.encode-fm(0xc0005b7880, 0xc080e0, 0xc0025f1cd8, 0x199, 0xc00100)
	/usr/local/go/src/encoding/json/encode.go:635 +0x7f fp=0xc002f6aa48 sp=0xc002f6a9f0 pc=0x50897f
encoding/json.arrayEncoder.encode(0xc0003a70e0, 0xc0005b7880, 0xb55540, 0xc0025f1e98, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:791 +0xd6 fp=0xc002f6aaa0 sp=0xc002f6aa48 pc=0x4fe2e6
encoding/json.arrayEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc0025f1e98, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:784 +0x64 fp=0xc002f6aae0 sp=0xc002f6aaa0 pc=0x508b04
encoding/json.sliceEncoder.encode(0xc00039ae60, 0xc0005b7880, 0xb55540, 0xc0025f1e98, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:765 +0x8f fp=0xc002f6ab28 sp=0xc002f6aae0 pc=0x4fdf4f
encoding/json.sliceEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc0025f1e98, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:760 +0x64 fp=0xc002f6ab68 sp=0xc002f6ab28 pc=0x508a84
encoding/json.typeEncoder.func1(0xc0005b7880, 0xb55540, 0xc0025f1e98, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:374 +0x79 fp=0xc002f6aba8 sp=0xc002f6ab68 pc=0x507d59
encoding/json.structEncoder.encode(0xc00042b200, 0xc, 0x10, 0xc0003a70b0, 0xc0005b7880, 0xc080e0, 0xc0025f1dd0, 0x199, 0x100)
	/usr/local/go/src/encoding/json/encode.go:664 +0x306 fp=0xc002f6ac48 sp=0xc002f6aba8 pc=0x4fd026
encoding/json.structEncoder.encode-fm(0xc0005b7880, 0xc080e0, 0xc0025f1dd0, 0x199, 0xc00100)
	/usr/local/go/src/encoding/json/encode.go:635 +0x7f fp=0xc002f6aca0 sp=0xc002f6ac48 pc=0x50897f
encoding/json.arrayEncoder.encode(0xc0003a70e0, 0xc0005b7880, 0xb55540, 0xc002727888, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:791 +0xd6 fp=0xc002f6acf8 sp=0xc002f6aca0 pc=0x4fe2e6
encoding/json.arrayEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc002727888, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:784 +0x64 fp=0xc002f6ad38 sp=0xc002f6acf8 pc=0x508b04
encoding/json.sliceEncoder.encode(0xc00039ae60, 0xc0005b7880, 0xb55540, 0xc002727888, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:765 +0x8f fp=0xc002f6ad80 sp=0xc002f6ad38 pc=0x4fdf4f
encoding/json.sliceEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc002727888, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:760 +0x64 fp=0xc002f6adc0 sp=0xc002f6ad80 pc=0x508a84
encoding/json.typeEncoder.func1(0xc0005b7880, 0xb55540, 0xc002727888, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:374 +0x79 fp=0xc002f6ae00 sp=0xc002f6adc0 pc=0x507d59
encoding/json.structEncoder.encode(0xc00042b200, 0xc, 0x10, 0xc0003a70b0, 0xc0005b7880, 0xc080e0, 0xc0027277c0, 0x199, 0x100)
	/usr/local/go/src/encoding/json/encode.go:664 +0x306 fp=0xc002f6aea0 sp=0xc002f6ae00 pc=0x4fd026
encoding/json.structEncoder.encode-fm(0xc0005b7880, 0xc080e0, 0xc0027277c0, 0x199, 0xc00100)
	/usr/local/go/src/encoding/json/encode.go:635 +0x7f fp=0xc002f6aef8 sp=0xc002f6aea0 pc=0x50897f
encoding/json.arrayEncoder.encode(0xc0003a70e0, 0xc0005b7880, 0xb55540, 0xc002727c68, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:791 +0xd6 fp=0xc002f6af50 sp=0xc002f6aef8 pc=0x4fe2e6
encoding/json.arrayEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc002727c68, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:784 +0x64 fp=0xc002f6af90 sp=0xc002f6af50 pc=0x508b04
encoding/json.sliceEncoder.encode(0xc00039ae60, 0xc0005b7880, 0xb55540, 0xc002727c68, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:765 +0x8f fp=0xc002f6afd8 sp=0xc002f6af90 pc=0x4fdf4f
encoding/json.sliceEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc002727c68, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:760 +0x64 fp=0xc002f6b018 sp=0xc002f6afd8 pc=0x508a84
encoding/json.typeEncoder.func1(0xc0005b7880, 0xb55540, 0xc002727c68, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:374 +0x79 fp=0xc002f6b058 sp=0xc002f6b018 pc=0x507d59
encoding/json.structEncoder.encode(0xc00042b200, 0xc, 0x10, 0xc0003a70b0, 0xc0005b7880, 0xc080e0, 0xc002727ba0, 0x199, 0x100)
	/usr/local/go/src/encoding/json/encode.go:664 +0x306 fp=0xc002f6b0f8 sp=0xc002f6b058 pc=0x4fd026
encoding/json.structEncoder.encode-fm(0xc0005b7880, 0xc080e0, 0xc002727ba0, 0x199, 0xc00100)
	/usr/local/go/src/encoding/json/encode.go:635 +0x7f fp=0xc002f6b150 sp=0xc002f6b0f8 pc=0x50897f
encoding/json.arrayEncoder.encode(0xc0003a70e0, 0xc0005b7880, 0xb55540, 0xc002727e58, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:791 +0xd6 fp=0xc002f6b1a8 sp=0xc002f6b150 pc=0x4fe2e6
encoding/json.arrayEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc002727e58, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:784 +0x64 fp=0xc002f6b1e8 sp=0xc002f6b1a8 pc=0x508b04
encoding/json.sliceEncoder.encode(0xc00039ae60, 0xc0005b7880, 0xb55540, 0xc002727e58, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:765 +0x8f fp=0xc002f6b230 sp=0xc002f6b1e8 pc=0x4fdf4f
encoding/json.sliceEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc002727e58, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:760 +0x64 fp=0xc002f6b270 sp=0xc002f6b230 pc=0x508a84
encoding/json.typeEncoder.func1(0xc0005b7880, 0xb55540, 0xc002727e58, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:374 +0x79 fp=0xc002f6b2b0 sp=0xc002f6b270 pc=0x507d59
encoding/json.structEncoder.encode(0xc00042b200, 0xc, 0x10, 0xc0003a70b0, 0xc0005b7880, 0xc080e0, 0xc002727d90, 0x199, 0x100)
	/usr/local/go/src/encoding/json/encode.go:664 +0x306 fp=0xc002f6b350 sp=0xc002f6b2b0 pc=0x4fd026
encoding/json.structEncoder.encode-fm(0xc0005b7880, 0xc080e0, 0xc002727d90, 0x199, 0xc00100)
	/usr/local/go/src/encoding/json/encode.go:635 +0x7f fp=0xc002f6b3a8 sp=0xc002f6b350 pc=0x50897f
encoding/json.arrayEncoder.encode(0xc0003a70e0, 0xc0005b7880, 0xb55540, 0xc002727f50, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:791 +0xd6 fp=0xc002f6b400 sp=0xc002f6b3a8 pc=0x4fe2e6
encoding/json.arrayEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc002727f50, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:784 +0x64 fp=0xc002f6b440 sp=0xc002f6b400 pc=0x508b04
encoding/json.sliceEncoder.encode(0xc00039ae60, 0xc0005b7880, 0xb55540, 0xc002727f50, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:765 +0x8f fp=0xc002f6b488 sp=0xc002f6b440 pc=0x4fdf4f
encoding/json.sliceEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc002727f50, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:760 +0x64 fp=0xc002f6b4c8 sp=0xc002f6b488 pc=0x508a84
encoding/json.typeEncoder.func1(0xc0005b7880, 0xb55540, 0xc002727f50, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:374 +0x79 fp=0xc002f6b508 sp=0xc002f6b4c8 pc=0x507d59
encoding/json.structEncoder.encode(0xc00042b200, 0xc, 0x10, 0xc0003a70b0, 0xc0005b7880, 0xc080e0, 0xc002727e88, 0x199, 0x100)
	/usr/local/go/src/encoding/json/encode.go:664 +0x306 fp=0xc002f6b5a8 sp=0xc002f6b508 pc=0x4fd026
encoding/json.structEncoder.encode-fm(0xc0005b7880, 0xc080e0, 0xc002727e88, 0x199, 0xc00100)
	/usr/local/go/src/encoding/json/encode.go:635 +0x7f fp=0xc002f6b600 sp=0xc002f6b5a8 pc=0x50897f
encoding/json.arrayEncoder.encode(0xc0003a70e0, 0xc0005b7880, 0xb55540, 0xc000248fa0, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:791 +0xd6 fp=0xc002f6b658 sp=0xc002f6b600 pc=0x4fe2e6
encoding/json.arrayEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc000248fa0, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:784 +0x64 fp=0xc002f6b698 sp=0xc002f6b658 pc=0x508b04
encoding/json.sliceEncoder.encode(0xc00039ae60, 0xc0005b7880, 0xb55540, 0xc000248fa0, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:765 +0x8f fp=0xc002f6b6e0 sp=0xc002f6b698 pc=0x4fdf4f
encoding/json.sliceEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc000248fa0, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:760 +0x64 fp=0xc002f6b720 sp=0xc002f6b6e0 pc=0x508a84
encoding/json.typeEncoder.func1(0xc0005b7880, 0xb55540, 0xc000248fa0, 0x197, 0x100)
	/usr/local/go/src/encoding/json/encode.go:374 +0x79 fp=0xc002f6b760 sp=0xc002f6b720 pc=0x507d59
encoding/json.structEncoder.encode(0xc00042b200, 0xc, 0x10, 0xc0003a70b0, 0xc0005b7880, 0xc080e0, 0xc000248ed8, 0x199, 0x100)
	/usr/local/go/src/encoding/json/encode.go:664 +0x306 fp=0xc002f6b800 sp=0xc002f6b760 pc=0x4fd026
encoding/json.structEncoder.encode-fm(0xc0005b7880, 0xc080e0, 0xc000248ed8, 0x199, 0xc00100)
	/usr/local/go/src/encoding/json/encode.go:635 +0x7f fp=0xc002f6b858 sp=0xc002f6b800 pc=0x50897f
encoding/json.arrayEncoder.encode(0xc0003a70e0, 0xc0005b7880, 0xb55540, 0xc002d31500, 0x97, 0x4f0100)
	/usr/local/go/src/encoding/json/encode.go:791 +0xd6 fp=0xc002f6b8b0 sp=0xc002f6b858 pc=0x4fe2e6
encoding/json.arrayEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc002d31500, 0x97, 0xc002ea0100)
	/usr/local/go/src/encoding/json/encode.go:784 +0x64 fp=0xc002f6b8f0 sp=0xc002f6b8b0 pc=0x508b04
encoding/json.sliceEncoder.encode(0xc00039ae60, 0xc0005b7880, 0xb55540, 0xc002d31500, 0x97, 0xb50100)
	/usr/local/go/src/encoding/json/encode.go:765 +0x8f fp=0xc002f6b938 sp=0xc002f6b8f0 pc=0x4fdf4f
encoding/json.sliceEncoder.encode-fm(0xc0005b7880, 0xb55540, 0xc002d31500, 0x97, 0x7f4678a00100)
	/usr/local/go/src/encoding/json/encode.go:760 +0x64 fp=0xc002f6b978 sp=0xc002f6b938 pc=0x508a84
encoding/json.(*encodeState).reflectValue(0xc0005b7880, 0xb55540, 0xc002d31500, 0x97, 0x400100)
	/usr/local/go/src/encoding/json/encode.go:337 +0x82 fp=0xc002f6b9b0 sp=0xc002f6b978 pc=0x4fa862
encoding/json.(*encodeState).marshal(0xc0005b7880, 0xb55540, 0xc002d31500, 0x100, 0x0, 0x0)
	/usr/local/go/src/encoding/json/encode.go:309 +0x10b fp=0xc002f6ba30 sp=0xc002f6b9b0 pc=0x4fa30b
encoding/json.Marshal(0xb55540, 0xc002d31500, 0xc000035180, 0x7f4678a0e6d0, 0x0, 0x21, 0xc001e0c160)
	/usr/local/go/src/encoding/json/encode.go:161 +0x52 fp=0xc002f6baa8 sp=0xc002f6ba30 pc=0x4f98e2
encoding/json.MarshalIndent(0xb55540, 0xc002d31500, 0x0, 0x0, 0xca67e5, 0x1, 0xc000dab500, 0x1f, 0x21, 0xc000247a80, ...)
	/usr/local/go/src/encoding/json/encode.go:177 +0x3f fp=0xc002f6bb30 sp=0xc002f6baa8 pc=0x4f9a8f
github.com/phodal/coca/cmd.glob..func1(0x1592040, 0xc00011ffb0, 0x1, 0x1)
	/root/go/pkg/mod/github.com/phodal/[email protected]/cmd/analysis.go:41 +0x32f fp=0xc002f6bd80 sp=0xc002f6bb30 pc=0xaf55ef
github.com/spf13/cobra.(*Command).execute(0x1592040, 0xc00011fd90, 0x1, 0x1, 0x1592040, 0xc00011fd90)
	/root/go/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x2aa fp=0xc002f6be58 sp=0xc002f6bd80 pc=0x6e6a6a
github.com/spf13/cobra.(*Command).ExecuteC(0x15940c0, 0x0, 0x9c380, 0xc0000ac058)
	/root/go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fb fp=0xc002f6bf30 sp=0xc002f6be58 pc=0x6e766b
github.com/spf13/cobra.(*Command).Execute(...)
	/root/go/pkg/mod/github.com/spf13/[email protected]/command.go:864
main.main()
	/root/go/pkg/mod/github.com/phodal/[email protected]/coca.go:12 +0x75 fp=0xc002f6bf60 sp=0xc002f6bf30 pc=0xafafc5
runtime.main()
	/usr/local/go/src/runtime/proc.go:203 +0x21e fp=0xc002f6bfe0 sp=0xc002f6bf60 pc=0x43024e
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc002f6bfe8 sp=0xc002f6bfe0 pc=0x45ad61

Panic when run bad small scan for AOSP framework

Coca Version: 2.3.0
OS: Ubuntu 18.04.3 and 22.04

Run following command under frameworks folder of aosp repo

coca bs -s type

will get following panic

panic: interface conversion: interface is nil, not antlr.ParseTree

coca outpuit

2022/12/08 14:53:35 profile: cpu profiling enabled, /tmp/profile2012546155/cpu.pprof
open ./.gitignore: no such file or directory
parse java call: AutoFitTextureView.java
parse java call: MainActivity.java
parse java call: MediaCodecBase.java
parse java call: MediaCodecSurfaceEncoder.java
parse java call: NalUnitUtil.java
parse java call: ParsableBitArray.java
parse java call: CodecUtils.java
parse java call: Decoder.java
parse java call: Encoder.java
parse java call: Extractor.java
parse java call: Muxer.java
parse java call: Native.java
parse java call: Stats.java
parse java call: MainActivity.java
parse java call: ResourcePolicyTestActivity.java
parse java call: AbstractAutofillPerfTestCase.java
parse java call: AutofillTestHelper.java
parse java call: AutofillTestWatcher.java
parse java call: MyAutofillCallback.java
parse java call: MyAutofillService.java
parse java call: AtraceUtils.java
parse java call: AbstractContentCapturePerfTestCase.java
parse java call: CustomTestActivity.java
parse java call: MyContentCaptureService.java
parse java call: PackageManagerBenchmark.java
parse java call: TableHelper.java
parse java call: R.java
parse java call: SomeProvider.java
parse java call: SomeService.java
parse java call: NonEditableTextGenerator.java
parse java call: TextPerfUtils.java
parse java call: CutoutSpecificationBenchmark.java
parse java call: InputStageBenchmark.java
parse java call: ImePerfRunPrecondition.java
parse java call: ImePerfTestBase.java
parse java call: DummyForegroundActivity.java
parse java call: BenchmarkResults.java
parse java call: BenchmarkResultsReporter.java
parse java call: BenchmarkRunner.java
parse java call: BroadcastWaiter.java
parse java call: PackageInstallerBenchmark.java
parse java call: BenchmarkState.java
parse java call: BitmapUtils.java
parse java call: LayoutUtils.java
parse java call: ManualBenchmarkState.java
parse java call: OneTimeSettingsListener.java
parse java call: PerfManualStatusReporter.java
parse java call: PerfStatusReporter.java
parse java call: PerfTestActivity.java
parse java call: SettingsHelper.java
parse java call: SettingsStateKeeperRule.java
parse java call: SettingsStateManager.java
parse java call: ShellHelper.java
parse java call: StateKeeperRule.java
parse java call: StateManager.java
parse java call: Stats.java
parse java call: TestPackageInstaller.java
parse java call: TestUtils.java
parse java call: TraceMarkParser.java
parse java call: WindowPerfRunPreconditionBase.java
parse java call: WindowPerfTestBase.java
parse java call: WindowManagerPerfTestBase.java
parse java call: WmPerfRunListener.java
parse java call: FrameworksTestsFilter.java
parse java call: BlobHandle.java
parse java call: BlobInfo.java
parse java call: BlobStoreManager.java
parse java call: BlobStoreManagerFrameworkInitializer.java
parse java call: LeaseInfo.java
parse java call: XmlTags.java
parse java call: BlobAccessMode.java
parse java call: BlobMetadata.java
parse java call: BlobStoreConfig.java
parse java call: BlobStoreIdleJobService.java
parse java call: BlobStoreManagerInternal.java
parse java call: BlobStoreManagerService.java
parse java call: BlobStoreManagerShellCommand.java
parse java call: BlobStoreSession.java
parse java call: BlobStoreUtils.java
parse java call: AlarmManager.java
parse java call: JobSchedulerImpl.java
parse java call: JobInfo.java
parse java call: JobParameters.java
parse java call: JobScheduler.java
parse java call: JobSchedulerFrameworkInitializer.java
parse java call: JobService.java
parse java call: JobServiceEngine.java
parse java call: JobSnapshot.java
parse java call: JobWorkItem.java
parse java call: EconomyManager.java
parse java call: DeviceIdleManager.java
parse java call: PowerExemptionManager.java
parse java call: PowerWhitelistManager.java
parse java call: AppStateTracker.java
parse java call: DeviceIdleInternal.java
parse java call: PowerAllowlistInternal.java
parse java call: ConstraintController.java
parse java call: IDeviceIdleConstraint.java
parse java call: JobSchedulerInternal.java
parse java call: AppStandbyInternal.java
parse java call: AnyMotionDetector.java
parse java call: AppStateTrackerImpl.java
parse java call: DeviceIdleController.java
parse java call: JobSchedulerBackgroundThread.java
parse java call: Alarm.java
parse java call: AlarmManagerService.java
parse java call: AlarmStore.java
parse java call: BatchingAlarmStore.java
parse java call: LazyAlarmStore.java
parse java call: MetricsHelper.java
parse java call: TareBill.java
parse java call: BluetoothConstraint.java
parse java call: DeviceIdleConstraintTracker.java
parse java call: TvConstraintController.java
parse java call: GrantedUriPermissions.java
parse java call: JobCompletedListener.java
parse java call: JobConcurrencyManager.java
2022/12/08 14:53:43 profile: cpu profiling disabled, /tmp/profile2012546155/cpu.pprof
panic: interface conversion: interface is nil, not antlr.ParseTree

goroutine 1 [running]:
github.com/modernizing/coca/pkg/infrastructure/ast/bs_java.(*BadSmellListener).EnterLocalVariableDeclaration(0x40a62d?, 0xc00bbaeaf8)
	/home/runner/work/coca/coca/pkg/infrastructure/ast/bs_java/bad_smell_listener.go:173 +0xcc
github.com/modernizing/coca/languages/java.(*LocalVariableDeclarationContext).EnterRule(0xc008fe5460?, {0xb68288?, 0x1067898?})
	/home/runner/work/coca/coca/languages/java/java_parser.go:11227 +0x45
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).EnterRule(0xc00bbaeab0?, {0xb68288, 0x1067898}, {0x7f115a5b24d0?, 0xc00bbaeaf8?})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:244 +0x86
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc00bbae468?, {0xb68288, 0x1067898}, {0xb6a558?, 0xc00bbaeaf8})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:228 +0xba
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc00bbae450?, {0xb68288, 0x1067898}, {0xb69598?, 0xc00bbaeab0})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:231 +0x108
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc00baa5b00?, {0xb68288, 0x1067898}, {0xb69550?, 0xc00bbae468})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:231 +0x108
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc00baa5ae8?, {0xb68288, 0x1067898}, {0xb6a5e8?, 0xc00bbae450})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:231 +0x108
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc00b9b5b30?, {0xb68288, 0x1067898}, {0xb6a678?, 0xc00baa5b00})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:231 +0x108
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc0016ebb60?, {0xb68288, 0x1067898}, {0xb6a5a0?, 0xc00baa5ae8})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:231 +0x108
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc0016ebb48?, {0xb68288, 0x1067898}, {0xb696b8?, 0xc00b9b5b30})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:231 +0x108
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc0016ebb30?, {0xb68288, 0x1067898}, {0xb69670?, 0xc0016ebb60})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:231 +0x108
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc0016eb098?, {0xb68288, 0x1067898}, {0xb69748?, 0xc0016ebb48})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:231 +0x108
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc0016eb098?, {0xb68288, 0x1067898}, {0xb6ac60?, 0xc0016ebb30})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:231 +0x108
github.com/antlr/antlr4/runtime/Go/antlr.(*ParseTreeWalker).Walk(0xc00aeedb08?, {0xb68288, 0x1067898}, {0xb69868?, 0xc0016eb098})
	/home/runner/go/pkg/mod/github.com/antlr/antlr4/runtime/!go/[email protected]/tree.go:231 +0x108
github.com/modernizing/coca/pkg/application/bs.(*BadSmellApp).AnalysisPath(0x0?, {0xa918a1?, 0xa9189f?})
	/home/runner/work/coca/coca/pkg/application/bs/bad_smell_app.go:37 +0x2a5
github.com/modernizing/coca/cmd.glob..func4(0x1015200?, {0xa9206e?, 0x2?, 0x2?})
	/home/runner/work/coca/coca/cmd/bs.go:33 +0xfa
github.com/spf13/cobra.(*Command).execute(0x1015200, {0xc00032f700, 0x2, 0x2})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1014580)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2ee
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:864
main.main()
	/home/runner/work/coca/coca/coca.go:16 +0xff

how use in golang project

  1. cd my_project,my_project is a golang project
  2. go mod tidy, get the depend of the project
  3. coca analysis
  4. show nothing
2022/11/16 10:35:43 profile: cpu profiling enabled, /var/folders/f6/x0fpn6ws1psbrv1jkrz_vvr40000gp/T/profile536435785/cpu.pprof
| REFS COUNT | METHOD |
|------------|--------|
App elapsed:  824.074µs
2022/11/16 10:35:43 profile: cpu profiling disabled, /var/folders/f6/x0fpn6ws1psbrv1jkrz_vvr40000gp/T/profile536435785/cpu.pprof

Update README.md

go install github.com/phodal/cocago

        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.

zsh: command not found: coca

zsh: command not found: coca when i was run go install coca
please tell me how can i fix it
its my first contact with go language
thx!!!😊

web support

I have a lot of projects, and the coca result want share to other people.

team members summary

Describe the solution you'd like

Describe alternatives you've considered

记录代码库开发人员第一次代码修改时间和最后一次修改时间,以及对应代码库的年限,计算『类“离职”』率要素。

Additional context

module change frequency

Is your feature request related to a problem? Please describe.

对于单一代码库的系统而言,文件系统的组织方式(文件夹)可以视为一个通用的模块定义标准。一个系统可能在某一目录下包含相关的代码,如底级目录,还存在二级目录:

如:https://hg.mozilla.org/mozilla-central/file

drwxr-xr-x |   |   | .cargo | files
-- | -- | -- | -- | --
drwxr-xr-x |   |   | .vscode | files
drwxr-xr-x |   |   | accessible | files
drwxr-xr-x |   |   | browser | files
drwxr-xr-x |   |   | build | files
drwxr-xr-x |   |   | caps | files
drwxr-xr-x |   |   | chrome | files
drwxr-xr-x |   |   | config | files
drwxr-xr-x |   |   | devtools | files
drwxr-xr-x |   |   | docs | files
drwxr-xr-x |   |   | docshell | files
drwxr-xr-x |   |   | dom | files
drwxr-xr-x |   |   | editor | files
drwxr-xr-x |   |   | extensions | files
drwxr-xr-x |   |   | gfx | files
drwxr-xr-x |   |   | gradle wrapper | files
drwxr-xr-x |   |   | hal | files
drwxr-xr-x |   |   | image | files
drwxr-xr-x |   |   | intl | files
drwxr-xr-x |   |   | ipc | files
drwxr-xr-x |   |   | js | files
drwxr-xr-x |   |   | layout | files
drwxr-xr-x |   |   | media | files
drwxr-xr-x |   |   | memory | files
drwxr-xr-x |   |   | mfbt | files
drwxr-xr-x |   |   | mobile | files
drwxr-xr-x |   |   | modules | files
drwxr-xr-x |   |   | mozglue | files
drwxr-xr-x |   |   | netwerk | files
drwxr-xr-x |   |   | nsprpub | files
drwxr-xr-x |   |   | other-licenses | files
drwxr-xr-x |   |   | parser | files
drwxr-xr-x |   |   | python | files
drwxr-xr-x |   |   | remote | files
drwxr-xr-x |   |   | security | files
drwxr-xr-x |   |   | services | files
drwxr-xr-x |   |   | servo | files
drwxr-xr-x |   |   | startupcache | files
drwxr-xr-x |   |   | storage | files
drwxr-xr-x |   |   | taskcluster | files
drwxr-xr-x |   |   | testing | files
drwxr-xr-x |   |   | third_party | files
drwxr-xr-x |   |   | toolkit | files
drwxr-xr-x |   |   | tools | files
drwxr-xr-x |   |   | uriloader | files
drwxr-xr-x |   |   | view | files
drwxr-xr-x |   |   | widget | files
drwxr-xr-x |   |   | xpcom | files

通过识别不同模块下的代码修改频次,我们可以定义出经常出现问题的模块。

Describe the solution you'd like

提供一个接口查找和分析不同模块/目录下的修改频率

Describe alternatives you've considered

Additional context

Parallel parser

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

  1. generate temp json file
  2. concat json file
  3. delete cache file

Additional context
Add any other context or screenshots about the feature request here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.