返回顶部
c

code-metrics代码度量分析

Analyze code quality metrics including lines of code by language, cyclomatic complexity (Python), function/class counts, comment ratios, and largest file rankings. Use when asked to analyze code quality, count lines of code, measure complexity, find the biggest files, get a project overview, or audit code metrics across a codebase. Supports Python, JavaScript, TypeScript, Go, Rust, Ruby, Java, C/C++, C#, Swift, Kotlin, PHP, Shell, Lua, R, and Scala.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
109
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

code-metrics

代码度量

分析项目中代码质量与复杂度指标。支持17种以上语言。

快速开始

bash

分析当前项目


python3 scripts/code_metrics.py

分析指定目录

python3 scripts/code_metrics.py /path/to/project

JSON格式输出

python3 scripts/code_metrics.py --json

跳过复杂度分析(速度更快)

python3 scripts/code_metrics.py --no-complexity

排除额外目录

python3 scripts/code_metrics.py --exclude migrations fixtures

提供的度量指标

  • - 代码行数 — 每种语言的总行数、代码行数、注释行数、空行数
  • 注释与代码比率 — 整体文档密度
  • 函数与类数量 — 按语言统计
  • 圈复杂度 — 针对Python文件的每个函数(基于AST)
  • 最大文件 — 按代码行数排序的前N个文件
  • 高复杂度警告 — 标记复杂度≥5的函数

复杂度等级(Python)

范围风险含义
1-4🟢 低简单,结构良好
5-9
🟢 中等 | 可接受 | | 10-14 | 🟡 高 | 建议重构 | | 15+ | 🔴 非常高 | 强烈建议重构 |

依赖项

  • - Python 3.8+(仅需标准库,无需pip包)

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 code-metrics-1776050888 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 code-metrics-1776050888 技能

通过命令行安装

skillhub install code-metrics-1776050888

下载

⬇ 下载 code-metrics v1.0.0(免费)

文件大小: 5.03 KB | 发布时间: 2026-4-14 14:44

v1.0.0 最新 2026-4-14 14:44
Initial release of code-metrics.

- Analyze code quality metrics across 17+ programming languages.
- Reports lines of code, comment ratios, function/class counts, and largest files.
- Measures cyclomatic complexity for Python (with per-function details and warnings).
- Offers JSON output, directory exclusion, and complexity analysis toggling.
- Requires only Python 3.8+ with no external dependencies.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部