箭头林
TypeScript/JavaScript 项目的快速,基于 AST 架构的嗅觉检测器
一个强大的CLI工具,用于检测TypeScript/JavaScript代码库中30+类型的建筑气味. 由罗斯特和 oxc 用于最大性能的参数.
为什么是阿克林特?
现代密码库发展得很快。 Archlint帮助你:
- 🔍 及早发现建筑问题 在成为技术债务之前
- 🎯 框架认识分析 包含 NestJS、Next.js、React、oclif预设
- ⚡ 闪亮快活 - 在5秒内分析200多份文件
- 📊 可采取行动的见解 - 明确解释、严重程度分数和重构建议
- 🔄 监视模式 在开发过程中提供实时反馈
- 🧠 智能缓存 用于即时再运行
特征
30+ 建筑气味探测器
依赖性和结构问题:
- 循环依赖( 文件级别和类型级别)
- 枢纽模块(太多连接)
- 神模块(做太多)
- 已死代码( 未用导出)
- 孤儿类型( 脱离代码库)
设计质量问题:
- 低一致性(LCOM 度量)
- 高接头
- 层层侵犯(领域/应用/基础设施)
- 违反社民党规定(稳定依赖原则)
- 特别羡慕 猎枪手术
守则组织问题:
- 档案滥用
- 分解模块/配置
- 原始的痴迷
- 长参数列表
- 深层筑巢
框架具体问题:
- 试验泄漏(生产中的试验代码)
- 副作用进口
- 供应商组合
- 不稳定的接口
- 共享可变状态
框架情报
理解框架模式的内置预设:
- 网点JS:知道控制器是切入点,模块可以有高耦合度
- 下一个.js: 了解页面/ API 路由, 放松桶文件规则
- 反应: 了解组件模式, 跳过不相关的检查
- 奥克利夫: 识别 CLI 命令和钩
输出格式
- 图表 (默认) - 有颜色的清洁终端输出
- 标记 - 有关人鱼依赖图的详细报告
- 贾森 - 计算机可读化中心/光盘集成
开发者经验
- 监视模式 用于实时反馈的调试
- 智能缓存 使用内容散列
- 严重性过滤 (低/中/高/关键)
- 选择检测器运行 (包括/不包括具体检查)
- Git 整合 用于分析
- 爱心 静态模式
安装
使用 npm( 建议)
npm install -g @archlinter/cli
# or use without installation
npx @archlinter/cli scan
从源
git clone https://github.com/superprotocol/archlint.git
cd archlint
cargo build --release
cargo install --path crates/archlint
快速启动
基本扫描
archlint scan ./my-project
带有配置
archlint scan ./my-project --config .archlint.yaml
开发的监视模式
archlint watch --debounce 500 --clear
出口报告
# Markdown with diagrams
archlint scan ./my-project --format markdown --report architecture-report.md
# JSON for CI/CD
archlint scan ./my-project --format json --report report.json
# Or use the shorter --json flag
archlint scan ./my-project --json --report report.json
按严重程度过滤
archlint scan --min-severity high
运行特定探测器
archlint scan --detectors cycles,god_module,dead_code
不包括探测器
archlint scan --exclude-detectors barrel_file,lcom
配置
创建 .archlint.yaml 在您的工程根中 :
# Files/directories to ignore
ignore:
- '**/node_modules/**'
- '**/dist/**'
# Path aliases (from tsconfig.json)
aliases:
'@/*': 'src/*'
# Entry points (won't be marked as dead code)
entry_points:
- 'src/main.ts'
# Rule-specific configuration
rules:
cycles: high
god_module:
severity: high
fan_in: 15
fan_out: 15
churn: 20
layer_violation:
severity: high
layers:
- name: domain
path: '**/domain/**'
allowed_imports: []
- name: application
path: '**/application/**'
allowed_imports: ['domain']
complexity:
max_complexity: 15
# Rule overrides for specific paths
overrides:
- files: ['**/tests/**']
rules:
complexity: off
god_module: off
# Scoring and grading settings
scoring:
minimum: medium
weights:
critical: 100
high: 50
medium: 20
low: 5
# Framework preset
extends: nestjs
可用的探测器
运行 archlint detectors list 可以看到所有带有描述的探测器.
| 身份证 | 名称 | 默认已启用 |
|---|---|---|
cycles | 循环依赖 | ✅ |
god_module | 神舱 | ✅ |
dead_code | 死亡代码 | ✅ |
layer_violation | 层违反 | ⚠️ |
complexity | 高度复杂性 | ✅ |
| . | . | . |
许可证
麻省理工学院执照 - 看 自由主义 详细情况.