/codedb

CodeDB 是一个专为软件开发本身开发的代码数据库,可以用于架构治理、代码生成等领域。基于架构孪生的理念,内建架构适度度函数、代码设计查询和存储 DSL、依赖分析引擎、机器学习算法等。

Primary LanguageKotlinMIT LicenseMIT

CodeDB: Technology Insight of Code

CI Maven Central

CodeDB Logo

CodeDB is a Technology Insight Platform for Software Development.

CodeDB 是一个专为软件开发本身开发的代码数据库,可以用于架构治理、代码生成等领域。基于架构孪生 的理念,内建架构适度度函数、代码设计查询和存储 DSL、依赖分析引擎、机器学习算法等。

Architecture diagram:

+------------------------------------------------------------+
|        +----------------+---------------+---------------+   |
|   UI   |    Workbench   | ArchComponent |     eDSL      |   |
|        +----------------+---------------+---------------+   |
+------------------------------------------------------------+
|        +----------------+---------------+---------------+   |
| Domain |   Kotlin REPL  | FitnessEngine |  Task Engine  |   |
|        +----------------+---------------+---------------+   |
+------------------------------------------------------------+
|        +----------------+---------------+---------------+   |
| DataAI |  Factor Model  | Structure QL  |    ML Algo    |   |
|        +----------------+---------------+---------------+   |
+------------------------------------------------------------+

Code DataStructure

  • server, which will provide the API
  • client
    • API, which will be used by other client
    • CLI,
    • CLUI (experiment)
    • Gradle Plugin
  • workflow-lib, which will be used by workflow
    • factor, foundation of fitness model
    • fitness-engine, define the basic element to calculate fitness
    • metric, common metric model of software
    • repl, kotlin REPL API
    • structure-ql, structure query language
    • task-core, the core of task engine
  • feeder, which will fill the data into database
    • test coverage
    • source code
    • security
    • sonarqube
    • ...

Principle

ThinSlice for Goal

By Level:

  • define Goal
  • custom Metric (Fitness function)
  • create flow for task
  • create job for task

Development

requirements: JDK 11, Node.js 16, MongoDB 5.0

Install

  1. setup JDK 11
  2. install MongoDB and start it
  3. start spring boot application
    • ./gradlew bootRun_

Scan Data with ArchGuard

test cli

java -jar/scanner_cli.jar --language=Kotlin --features=apicalls --output=http --output=json --path=. --server-url=http://localhost:8084

Known Issues

Why JDK 11 with MongoDB 5.0

问题:

  1. cglib 不支持 Java 17 Java 16 and 17 compatibility #191 : cglib/cglib#191
  2. QueryDSL MongoDB 5.0 只支持 MongoDB 6.0 以下版本(暂不支持 6.0),需要自己实现 querysql-mongodb。

License

This code is distributed under the MIT license. See LICENSE in this directory.