Git Product home page Git Product logo

archguard's Introduction

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

Local setup

database setup

  1. Local mysql, or docker created
  • docker pull mysql:8
  • docker run --name=mysql -it -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql
  1. Create archguard database
  • create database archguard default character set utf8mb4 collate utf8mb4_unicode_ci;
  • ./gradlew -Dflyway.configFiles=flyway.conf flywayMigrate (probably not needed)

run

./gradlew bootrun

Docker

mkdir -p archguard_mysql
chmod -R 777 archguard_mysql
docker-compose up

Known issues with Colima: docker mysql exited 137 memory

The default VM created by Colima has 2 CPUs, 2GiB memory and 60GiB storage. When run scanner in large projects, the default config will make MySQL exited, can to set more memory for ArchGuard:

colima start --cpu 4 --memory 8

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.

archguard's People

Contributors

dozencoder avatar huld2010 avatar phodal avatar abigail830 avatar qicaisheng avatar hezhong0711 avatar lixiang2-tw avatar hangliu6 avatar thxno avatar lianglliu avatar yoogodong avatar liguangzheng-tw avatar poseiden avatar isixline avatar huletw avatar twyunchen avatar wizardbyron avatar

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.