• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

guarding: Guarding 是一个用于 Java、JavaScript、Rust、Golang 等语言的架构守护工 ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

guarding

开源软件地址:

https://gitee.com/thoughtworks/guarding

开源软件介绍:

Guarding

Buildcrates.iodocs.rslicense

Guarding is a guardians for code, architecture, layered. Using git hooks and DSL for design guard rules.

Guarding Process

Usage

  1. install
cargo install guarding
  1. create guarding.guarding file
package(".")::file.len should < 200;package(".")::file.len should > 50;
  1. run
guarding .

Development

workflow:

  1. parsing guarding rules
  2. parsing source code to models
  3. capture rule with models

DSL capture logic:

  1. filter models from rule_level with rule_scope
  2. run expression
  3. run assert

Queries Samples: https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries

Guarding - Class or Struct function-name

for Java, JavaScript

# 类::名 包含 "Controller";# 中文分词:("..myapp..") 类名称中包含 "Controller"class("..myapp..")::function.name should contains("Model");# orclass("..myapp..")::function.name contains("");

for Rust and Golang

struct("..myapp..")::function.name should contains("Model");# orstruct("..myapp..")::function.name contains("");

Todos

todo:

  • filter
    • filter by package identifier
    • filter by regex
    • filter by implementation
    • filter by extends
    • filter by trait
  • limit impl naming
  • limit files num
  • limit package's sub-package size (for example, Clean Architecture).
  • assert
    • comparison for size / len
    • string comparison
      • contains
      • startsWith
      • endsWith
    • package ops
      • accessed
      • resideIn
      • dependBy
  • languages
    • Java
    • JavaScript (on Going)
    • TypeScript
    • Rust (on Going)
      • class & functions
      • imports
        • basic import
        • mods import restructure
      • package convert

License

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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap