Skip to content

ArchGuard is a architecture governance tool which can analysis architecture in container, component, code level, create architecure fitness functions, and anaysis system dependencies..

License

Notifications You must be signed in to change notification settings

xujianming2017/archguard

 
 

Repository files navigation

ArchGuard backend

CI codecov GitHub release (latest by date)

ArchGuard is a architecture governance tool which can analysis architecture in container, component, code level, database, create architecture fitness functions, and test for architecture rules.

Chinese: ArchGuard 是一个架构治理工具,用于管理和分析组织级别的软件架构。 结合 C4 模型,进行依赖分析,含容器级别(服务级别)、组件级别(/模块级别)、代码级别、数据库级别等。 同时,可以创建系统的架构适应度函数,度量系统的各项指标。

Components:

Screenshots:

1 2
3

特性(Features):

  • 容器级别依赖分析(当前支持 HTTP API)。API 生产者支持语言:Java、Kotlin、C#,API 消费者支持语言:TypeScript/JavaScript、Kotlin、Java 等。
    • HTTP API 使用清单、调用清单
    • HTTP API 依赖可视化分析
  • 五大维度架构质量评估以及对应的指标分析。
    • 体量维度。过大的包、类、方法、模块
    • 耦合维度。枢纽模块、包、类、方法,数据泥团、过深继承、循环依赖
    • 内聚维度。霰弹式修改、数据类
    • 冗余维度。冗余元素、过度泛化
    • 质量维度(Java)。包含休眠的测试、被忽略的测试、缺乏校验的测试、包含繁杂判断的测试、包含冗余打印的测试、静态方法
  • 代码坏味道分析。常见的那些。
  • 还有其它相关的总览
    • 代码间依赖分析。支持级别模块、包、类、方法四个级别。
    • 代码行数分析。
    • 系统不稳定性模块分析。
  • 数据库地图(进行中)
  • 精准测试/变化分析(进行中)

Features:

  • C4 analysis
    • container dependency analysis. (level: HTTP API)
      • basic fe/be call
      • RestTemplate for backend to backend
      • GraphQL
      • Kong Gateway
    • component (module) dependency analysis.
    • code dependency analysis. (level: pa``ckage, class, method)
    • database dependency analysis
  • Scanner integration
    • PMD
    • Git with jGit
      • HotFile
    • Java/Jvm only
      • JVM Bytecode (need to rewrite with License issue)
      • CheckStyle
      • Badsmell by DesigniteJava
      • Test Badsmell by Coca (Java only)
    • TypeScript with Chapi
    • Kotlin with Chapi
    • Git Hot File
  • System Info
    • Custom build command

Languages parse by Chapi

Features/Languages Java Python Go Kotlin TypeScript C C# Scala C++
http api decl 🆕 🆕 🆕 🆕 🆕
syntax parse 🆕 🆕
function call 🆕
arch/package
real world validate

Tech decision (framework)

  • languages:Kotlin
  • frameworks:Spring Boot,JDBI
  • test frameworks:Junit5,Spring Boot Test,Flyway,H2
  • build tool:Gradle
  • data storage:MySQL, InfluxDB

setup

  1. create database: create database archguard default character set utf8mb4 collate utf8mb4_unicode_ci;

  2. run migration: ./gradlew -Dflyway.configFiles=flyway.conf flywayMigrate

  3. run: ./gradlew bootrun

Docker

user docker-compose

docker-compose up

Chat

欢迎加入我们:

Q & A

Scanner 没有数据

java "-Ddburl=jdbc:mysql://localhost:3306/archguard?user=root&password=&useSSL=false" -jar scan_sourcecode.jar --system-id=6 --language=java --path=.
  1. 运行目录 scanner 中的 .jar 是否完整。如果出错了,需要从 GitHub 重新下载。
  2. 查看是否生成对应的 sql 文件。如果没有的话,建议可以提交 issue,包含错误日志。

vs APM

APM is awesome for developer. APM is build in runtime, ArchGuard is focus on development and rules. In archguard, not follow rule will not show data, better for governance.

APM 是在运行态发现架构问题的,ArchGuard 是运行在开发态。两者之间存在一些 gap,ArchGuard 专注于代码,更适用于通过规范来治理架构 —— 没有规范,没有数据。

License

@2020~2022 Thoughtworks. This code is distributed under the MPL license. See LICENSE in this directory.

About

ArchGuard is a architecture governance tool which can analysis architecture in container, component, code level, create architecure fitness functions, and anaysis system dependencies..

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 58.9%
  • Java 41.1%