Crates.io | guarding |
lib.rs | guarding |
version | 0.2.6 |
source | src |
created_at | 2021-05-13 09:16:04.331801 |
updated_at | 2021-10-22 12:25:04.339361 |
description | Guarding is a guardians for code, architecture, layered. Guarding crate a architecture aguard DSL which based on ArchUnit. |
homepage | https://github.com/inherd/guarding |
repository | https://github.com/inherd/guarding |
max_upload_size | |
id | 396855 |
size | 27,943 |
Guarding is a guardians for code, architecture, layered. Using git hooks and DSL for design guard rules.
Inspired by ArchUnit
cargo install guarding
guarding.guarding
filepackage(".")::file.len should < 200;
package(".")::file.len should > 50;
guarding .
guarding_adapter
, FFI adapter, provide Guarding api,guarding_core
, core guarding model,guarding_ident
, identify different language: Java, JavaScript, Rustguarding_parser
parsing Guarding DSLworkflow:
DSL capture logic:
rule_level
with rule_scope
Queries Samples: https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries
for packages:
class(implementation "BaseParser")::name should endsWith "Parser";
class("java.util.Map") only accessed(["com.phodal.pepper.refactor.staticclass"]);
class(implementation "BaseParser")::name should not contains "Lexer";
for Java, JavaScript
# 类::名 包含 "Controller";
# 中文分词:("..myapp..") 类名称中包含 "Controller"
class("..myapp..")::function.name should contains("Model");
# or
class("..myapp..")::function.name contains("");
for Rust and Golang
struct("..myapp..")::function.name should contains("Model");
# or
struct("..myapp..")::function.name contains("");
todo:
include(standard.guarding)
syntaxThis code is distributed under the MIT license. See LICENSE
in this directory.