轻量级前端框架代码健康智能评分引擎
A Lightweight Frontend Framework Code Health Intelligent Scoring Engine
语言切换 / Language Switch
FrameScore 是一款专为前端开发者打造的轻量级代码健康智能评分引擎。它能够深入扫描你的前端项目,基于 76 条内置规则对代码质量进行全面体检,最终输出一个直观的 0-100 健康评分及 A+ 到 F 等级评定。
在日常前端开发中,我们常常面临以下痛点:
FrameScore 的灵感来源于代码质量评分工具(如 Code Climate、SonarQube)的理念,但专注于前端框架特有的代码模式和最佳实践。我们希望为前端团队提供一个开箱即用、零配置、轻量高效的代码健康评估方案。
| 特性 | 描述 |
|---|---|
| 🏥 智能健康评分 | 基于 76 条规则的综合评分,0-100 分直观反映代码健康状态 |
| 📊 A+ 到 F 等级 | 科学的等级划分,快速了解项目质量水平 |
| ⚡ 并行分析引擎 | 多线程并行扫描,大幅提升大型项目分析速度 |
| 🔍 76 条内置规则 | 覆盖 React、Vue、Svelte、Angular 及通用、安全、性能六大类别 |
| 📦 依赖分析 | 自动检测项目依赖,识别缺失锁文件和非语义化版本 |
| 🔗 Git 集成 | 自动追踪评分历史,可视化代码质量变化趋势 |
| 📋 多种输出格式 | 支持 JSON、表格、Markdown 三种格式,满足不同使用场景 |
| 🎯 框架自动检测 | 智能识别项目使用的框架,自动加载对应规则集 |
| 🚫 零外部依赖 | 纯 Python 标准库实现,安装即用无负担 |
| ⚙️ 灵活配置 | 支持按严重程度过滤、指定框架、自定义工作线程数等 |
# 从 PyPI 安装(推荐)
pip install framescore
# 从 GitHub 安装最新版本
pip install git+https://github.com/gitstq/FrameScore.git
# 扫描当前目录
framescore scan .
# 扫描指定项目
framescore scan /path/to/your/project
# 查看版本信息
framescore -v
扫描完成后,你将看到类似以下的输出:
╔══════════════════════════════════════╗
║ FrameScore v1.0.0 ║
║ Code Health Scoring Engine ║
╚══════════════════════════════════════╝
Scanning project...
Framework: react
Files: 42 (3,856 lines)
Deps: 28 (18 prod, 10 dev)
Branch: main
Commits: 156
Completed in 2.3s | 23 issues found | Score: 78.5/100 (C+)
scan 是 FrameScore 的核心命令,用于对前端项目进行全面扫描和评分。
# 基本扫描
framescore scan <path>
# 指定输出格式
framescore scan <path> --format json # JSON 格式输出
framescore scan <path> --format markdown # Markdown 报告
framescore scan <path> --format table # 表格格式(默认)
# 指定前端框架
framescore scan <path> --framework react # React 项目
framescore scan <path> --framework vue # Vue 项目
framescore scan <path> --framework svelte # Svelte 项目
framescore scan <path> --framework angular # Angular 项目
framescore scan <path> --framework auto # 自动检测(默认)
# 按严重程度过滤
framescore scan <path> --severity error # 仅显示错误
framescore scan <path> --severity warning # 显示错误和警告
framescore scan <path> --severity info # 显示全部(默认)
# 保存报告到文件
framescore scan <path> --output report.md
framescore scan <path> --output report.json
framescore scan <path> -o result.md
# 跳过可选分析
framescore scan <path> --no-deps # 跳过依赖分析
framescore scan <path> --no-git # 跳过 Git 集成
# 性能调优
framescore scan <path> --workers 8 # 使用 8 个并行工作线程
framescore scan <path> --no-progress # 禁用进度条
# 组合使用
framescore scan ./my-react-app --framework react --format json --severity warning -o report.json
查看项目在 Git 提交历史中的评分变化趋势。
# 查看评分历史
framescore history <path>
# 示例输出
# Date Commit Score Grade Issues
# ----------------------------------------------------------
# 2024-01-15 10:30:22 a1b2c3d 82.3 B 18
# 2024-01-14 16:45:10 e4f5g6h 79.1 C+ 23
# 2024-01-13 09:12:05 i7j8k9l 85.6 B+ 15
#
# Trend: +3.2 (vs previous scan)
查看所有可用的分析规则。
# 列出所有规则
framescore rules
# 按框架过滤
framescore rules --framework react
framescore rules --framework vue
framescore rules --framework svelte
framescore rules --framework angular
framescore rules --framework general
# 按类别过滤
framescore rules --category security
framescore rules --category performance
framescore rules --category correctness
framescore rules --category best-practice
framescore rules --category accessibility
| 参数 | 缩写 | 说明 | 默认值 |
|---|---|---|---|
--format |
-f |
输出格式:table / json / markdown | table |
--framework |
框架选择:react / vue / svelte / angular / auto | auto | |
--severity |
最低严重级别:error / warning / info | info | |
--output |
-o |
报告输出文件路径 | - |
--workers |
-w |
并行工作线程数 | 4 |
--no-deps |
跳过依赖分析 | false | |
--no-git |
跳过 Git 集成 | false | |
--no-progress |
禁用进度条显示 | false | |
-v / --version |
显示版本号 | - |
FrameScore 采用基准分扣减制进行评分:
| 等级 | 分数范围 | 颜色标识 | 说明 |
|---|---|---|---|
| A+ | 95 - 100 | 🟢 优秀 | 代码质量卓越,几乎无问题 |
| A | 90 - 94 | 🟢 良好 | 代码质量很高,仅有少量提示 |
| B+ | 85 - 89 | 🔵 较好 | 代码质量较好,存在少量可改进项 |
| B | 80 - 84 | 🔵 中上 | 代码质量中等偏上,有一定改进空间 |
| C+ | 75 - 79 | 🟡 中等 | 代码质量中等,需要关注部分问题 |
| C | 70 - 74 | 🟡 中下 | 代码质量一般,建议尽快修复警告 |
| D | 60 - 69 | 🔴 较差 | 代码质量较差,存在较多问题 |
| F | < 60 | 🔴 不及格 | 代码质量堪忧,需要全面重构 |
| 级别 | 说明 | 示例 |
|---|---|---|
| 🔴 Error | 严重问题,可能导致 Bug 或安全漏洞 | 缺少 key 属性、eval() 使用、XSS 风险 |
| 🟡 Warning | 潜在问题,建议修复 | useEffect 缺少依赖数组、深层嵌套 |
| 🔵 Info | 代码改进建议 | 缺少注释、命名不规范、console 语句 |
FrameScore 内置 76 条规则,覆盖 7 大类别。以下为完整规则清单:
| 规则 ID | 名称 | 严重程度 | 类别 |
|---|---|---|---|
| REACT-001 | 列表渲染缺少 key 属性 | 🔴 Error | 正确性 |
| REACT-002 | useEffect 缺少依赖数组 | 🟡 Warning | 正确性 |
| REACT-003 | 直接 DOM 操作 | 🟡 Warning | 最佳实践 |
| REACT-004 | 缺少错误边界(Error Boundary) | 🔵 Info | 最佳实践 |
| REACT-005 | 动态列表使用 index 作为 key | 🟡 Warning | 正确性 |
| REACT-006 | useState 对象更新方式不当 | 🟡 Warning | 正确性 |
| REACT-007 | useEffect 缺少清理函数 | 🟡 Warning | 正确性 |
| REACT-008 | JSX 属性中的内联函数 | 🔵 Info | 性能 |
| REACT-009 | TypeScript 中使用 any 类型 | 🟡 Warning | 正确性 |
| REACT-010 | 缺少 PropTypes 或 TypeScript 类型定义 | 🔵 Info | 最佳实践 |
| REACT-011 | 对象/数组属性导致不必要重渲染 | 🔵 Info | 性能 |
| REACT-012 | 使用 dangerouslySetInnerHTML | 🔴 Error | 安全 |
| REACT-013 | img 标签缺少 alt 属性 | 🟡 Warning | 无障碍 |
| REACT-014 | 未使用的 import 语句 | 🔵 Info | 最佳实践 |
| REACT-015 | 生产代码中的 console 语句 | 🔵 Info | 最佳实践 |
| 规则 ID | 名称 | 严重程度 | 类别 |
|---|---|---|---|
| VUE-001 | v-for 指令缺少 :key 属性 | 🔴 Error | 正确性 |
| VUE-002 | 同一元素同时使用 v-if 和 v-for | 🟡 Warning | 最佳实践 |
| VUE-003 | 未使用的组件导入 | 🔵 Info | 最佳实践 |
| VUE-004 | 缺少 prop 类型验证 | 🔵 Info | 最佳实践 |
| VUE-005 | 直接修改 props | 🔴 Error | 正确性 |
| VUE-006 | 过度使用 $refs | 🟡 Warning | 最佳实践 |
| VUE-007 | 异步方法缺少错误处理 | 🟡 Warning | 正确性 |
| VUE-008 | 生产代码中的 console 语句 | 🔵 Info | 最佳实践 |
| VUE-009 | 不必要的深度监听器 | 🔵 Info | 性能 |
| VUE-010 | Transition 组件内缺少 key | 🟡 Warning | 正确性 |
| 规则 ID | 名称 | 严重程度 | 类别 |
|---|---|---|---|
| SVELTE-001 | {#each} 块缺少 key 表达式 | 🔴 Error | 正确性 |
| SVELTE-002 | 未使用的变量 | 🔵 Info | 最佳实践 |
| SVELTE-003 | Store 访问缺少 $ 前缀 | 🟡 Warning | 正确性 |
| SVELTE-004 | 生产代码中的 console 语句 | 🔵 Info | 最佳实践 |
| SVELTE-005 | 不必要的响应式声明 | 🔵 Info | 最佳实践 |
| SVELTE-006 | TypeScript 组件缺少类型注解 | 🔵 Info | 最佳实践 |
| SVELTE-007 | 无障碍问题(缺少 ARIA 标签) | 🟡 Warning | 无障碍 |
| SVELTE-008 | 组件文件过大 | 🟡 Warning | 最佳实践 |
| 规则 ID | 名称 | 严重程度 | 类别 |
|---|---|---|---|
| ANGULAR-001 | *ngFor 缺少 trackBy 函数 | 🟡 Warning | 性能 |
| ANGULAR-002 | TypeScript 中使用 any 类型 | 🟡 Warning | 正确性 |
| ANGULAR-003 | 生产代码中的 console 语句 | 🔵 Info | 最佳实践 |
| ANGULAR-004 | 未使用的 import 语句 | 🔵 Info | 最佳实践 |
| ANGULAR-005 | 缺少 OnPush 变更检测策略 | 🔵 Info | 性能 |
| ANGULAR-006 | 直接 DOM 访问 | 🟡 Warning | 最佳实践 |
| ANGULAR-007 | Observable 订阅缺少取消订阅 | 🟡 Warning | 正确性 |
| ANGULAR-008 | 组件文件过大 | 🟡 Warning | 最佳实践 |
| 规则 ID | 名称 | 严重程度 | 类别 |
|---|---|---|---|
| GEN-001 | 文件过长(超过 500 行) | 🟡 Warning | 最佳实践 |
| GEN-002 | 函数过于复杂(超过 50 行) | 🟡 Warning | 最佳实践 |
| GEN-003 | 缺少文件头注释 | 🔵 Info | 最佳实践 |
| GEN-004 | 命名规范不一致 | 🔵 Info | 最佳实践 |
| GEN-005 | TODO/FIXME/HACK 注释 | 🔵 Info | 最佳实践 |
| GEN-006 | 死代码(未使用的导出) | 🔵 Info | 最佳实践 |
| GEN-007 | 重复代码块 | 🟡 Warning | 最佳实践 |
| GEN-008 | 缺少错误处理 | 🟡 Warning | 正确性 |
| GEN-009 | 硬编码字符串 | 🔵 Info | 最佳实践 |
| GEN-010 | 缺少函数注释 | 🔵 Info | 最佳实践 |
| GEN-011 | 代码嵌套过深 | 🟡 Warning | 最佳实践 |
| GEN-012 | 魔法数字 | 🔵 Info | 最佳实践 |
| GEN-013 | 函数参数过多(超过 5 个) | 🟡 Warning | 最佳实践 |
| GEN-014 | TypeScript 缺少返回类型注解 | 🔵 Info | 最佳实践 |
| GEN-015 | 文件命名不一致 | 🔵 Info | 最佳实践 |
| 规则 ID | 名称 | 严重程度 | 类别 |
|---|---|---|---|
| SEC-001 | eval() 使用 | 🔴 Error | 安全 |
| SEC-002 | innerHTML 赋值 | 🔴 Error | 安全 |
| SEC-003 | 硬编码密钥/API 密钥 | 🔴 Error | 安全 |
| SEC-004 | 使用 http:// 而非 https:// | 🟡 Warning | 安全 |
| SEC-005 | SQL 注入模式 | 🔴 Error | 安全 |
| SEC-006 | 路径遍历模式 | 🔴 Error | 安全 |
| SEC-007 | 命令注入模式 | 🔴 Error | 安全 |
| SEC-008 | 不安全的随机数生成 | 🟡 Warning | 安全 |
| SEC-009 | CORS 通配符配置 | 🟡 Warning | 安全 |
| SEC-010 | localStorage 存储敏感数据 | 🟡 Warning | 安全 |
| 规则 ID | 名称 | 严重程度 | 类别 |
|---|---|---|---|
| PERF-001 | 大型库整体导入 | 🟡 Warning | 性能 |
| PERF-002 | 路由缺少懒加载 | 🔵 Info | 性能 |
| PERF-003 | 图片缺少 width/height 属性 | 🔵 Info | 性能 |
| PERF-004 | 同步文件操作 | 🟡 Warning | 性能 |
| PERF-005 | 不必要的重渲染模式 | 🔵 Info | 性能 |
| PERF-006 | 高频事件缺少防抖/节流 | 🔵 Info | 性能 |
| PERF-007 | 大型状态对象 | 🟡 Warning | 性能 |
| PERF-008 | 未优化的嵌套循环 | 🟡 Warning | 性能 |
| PERF-009 | 内存泄漏模式(事件监听器未清理) | 🟡 Warning | 性能 |
| PERF-010 | 大列表缺少虚拟化 | 🔵 Info | 性能 |
FrameScore 的设计遵循以下核心原则:
| 决策 | 选择 | 原因 |
|---|---|---|
| 实现语言 | Python | 丰富的文本处理能力,跨平台兼容性好 |
| 依赖管理 | 零外部依赖 | 降低安装门槛,避免版本冲突 |
| 并行策略 | 多线程(concurrent.futures) | I/O 密集型任务,多线程即可满足需求 |
| 规则引擎 | 基于正则表达式的模式匹配 | 轻量高效,无需 AST 解析器的复杂依赖 |
| 输出格式 | JSON / 表格 / Markdown | 覆盖 CI/CD 集成、终端查看、文档归档三大场景 |
.framescorerc)# 方式一:从 PyPI 安装(推荐)
pip install framescore
# 方式二:从 GitHub 安装最新开发版
pip install git+https://github.com/gitstq/FrameScore.git
# 方式三:从源码安装
git clone https://github.com/gitstq/FrameScore.git
cd FrameScore
pip install .
| Python 版本 | 支持状态 |
|---|---|
| 3.12 | ✅ 支持 |
| 3.11 | ✅ 支持 |
| 3.10 | ✅ 支持 |
| 3.9 | ✅ 支持 |
| 3.8 | ✅ 支持 |
| < 3.8 | ❌ 不支持 |
在 CI/CD 流水线中使用 FrameScore,实现自动化代码质量检查:
GitHub Actions 示例:
name: Code Health Check
on: [push, pull_request]
jobs:
framescore:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install FrameScore
run: pip install framescore
- name: Run FrameScore
run: framescore scan . --format json --output report.json --severity warning
- name: Check Score
run: |
SCORE=$(python -c "import json; print(json.load(open('report.json'))['health']['overall_score'])")
if (( $(echo "$SCORE < 70" | bc -l) )); then
echo "Score $SCORE is below threshold 70"
exit 1
fi
GitLab CI 示例:
code_health:
stage: test
image: python:3.11
script:
- pip install framescore
- framescore scan . --format json --output report.json --severity warning
artifacts:
paths:
- report.json
我们欢迎并感谢每一位贡献者!以下是参与贡献的指南:
git checkout -b feature/your-feature-namegit commit -m "feat: add your feature description"git push origin feature/your-feature-name请遵循 Conventional Commits 规范:
feat: 新功能fix: 修复 Bugdocs: 文档更新style: 代码格式调整refactor: 代码重构test: 测试相关chore: 构建/工具链相关提交 Issue 时,请包含以下信息:
FrameScore 基于 MIT License 开源。
MIT License
Copyright (c) 2024 FrameScore Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Made with ❤️ by FrameScore Team
如果你觉得 FrameScore 对你有帮助,请给项目点一个 ⭐ Star!
FrameScore 是一款專為前端開發者打造的輕量級程式碼健康智慧評分引擎。它能夠深入掃描你的前端專案,基於 76 條內建規則對程式碼品質進行全面體檢,最終輸出一個直觀的 0-100 健康評分及 A+ 到 F 等級評定。
在日常前端開發中,我們常常面臨以下痛點:
FrameScore 的靈感來源於程式碼品質評分工具(如 Code Climate、SonarQube)的理念,但專注於前端框架特有的程式碼模式和最佳實踐。我們希望為前端團隊提供一個開箱即用、零配置、輕量高效的程式碼健康評估方案。
| 特性 | 描述 |
|---|---|
| 🏥 智慧健康評分 | 基於 76 條規則的綜合評分,0-100 分直觀反映程式碼健康狀態 |
| 📊 A+ 到 F 等級 | 科學的等級劃分,快速了解專案品質水準 |
| ⚡ 平行分析引擎 | 多執行緒平行掃描,大幅提升大型專案分析速度 |
| 🔍 76 條內建規則 | 覆蓋 React、Vue、Svelte、Angular 及通用、安全、效能六大類別 |
| 📦 依賴分析 | 自動偵測專案依賴,識別缺失鎖定檔案和非語義化版本 |
| 🔗 Git 整合 | 自動追蹤評分歷史,視覺化程式碼品質變化趨勢 |
| 📋 多種輸出格式 | 支援 JSON、表格、Markdown 三種格式,滿足不同使用場景 |
| 🎯 框架自動偵測 | 智慧識別專案使用的框架,自動載入對應規則集 |
| 🚫 零外部依賴 | 純 Python 標準函式庫實作,安裝即用無負擔 |
| ⚙️ 靈活配置 | 支援按嚴重程度過濾、指定框架、自訂工作執行緒數等 |
# 從 PyPI 安裝(推薦)
pip install framescore
# 從 GitHub 安裝最新版本
pip install git+https://github.com/gitstq/FrameScore.git
# 掃描目前目錄
framescore scan .
# 掃描指定專案
framescore scan /path/to/your/project
# 查看版本資訊
framescore -v
掃描完成後,你將看到類似以下的輸出:
╔══════════════════════════════════════╗
║ FrameScore v1.0.0 ║
║ Code Health Scoring Engine ║
╚══════════════════════════════════════╝
Scanning project...
Framework: react
Files: 42 (3,856 lines)
Deps: 28 (18 prod, 10 dev)
Branch: main
Commits: 156
Completed in 2.3s | 23 issues found | Score: 78.5/100 (C+)
scan 是 FrameScore 的核心指令,用於對前端專案進行全面掃描和評分。
# 基本掃描
framescore scan <path>
# 指定輸出格式
framescore scan <path> --format json # JSON 格式輸出
framescore scan <path> --format markdown # Markdown 報告
framescore scan <path> --format table # 表格格式(預設)
# 指定前端框架
framescore scan <path> --framework react # React 專案
framescore scan <path> --framework vue # Vue 專案
framescore scan <path> --framework svelte # Svelte 專案
framescore scan <path> --framework angular # Angular 專案
framescore scan <path> --framework auto # 自動偵測(預設)
# 按嚴重程度過濾
framescore scan <path> --severity error # 僅顯示錯誤
framescore scan <path> --severity warning # 顯示錯誤和警告
framescore scan <path> --severity info # 顯示全部(預設)
# 儲存報告到檔案
framescore scan <path> --output report.md
framescore scan <path> --output report.json
framescore scan <path> -o result.md
# 跳過可選分析
framescore scan <path> --no-deps # 跳過依賴分析
framescore scan <path> --no-git # 跳過 Git 整合
# 效能調校
framescore scan <path> --workers 8 # 使用 8 個平行工作執行緒
framescore scan <path> --no-progress # 停用進度條
# 組合使用
framescore scan ./my-react-app --framework react --format json --severity warning -o report.json
查看專案在 Git 提交歷史中的評分變化趨勢。
# 查看評分歷史
framescore history <path>
# 範例輸出
# Date Commit Score Grade Issues
# ----------------------------------------------------------
# 2024-01-15 10:30:22 a1b2c3d 82.3 B 18
# 2024-01-14 16:45:10 e4f5g6h 79.1 C+ 23
# 2024-01-13 09:12:05 i7j8k9l 85.6 B+ 15
#
# Trend: +3.2 (vs previous scan)
查看所有可用的分析規則。
# 列出所有規則
framescore rules
# 按框架過濾
framescore rules --framework react
framescore rules --framework vue
framescore rules --framework svelte
framescore rules --framework angular
framescore rules --framework general
# 按類別過濾
framescore rules --category security
framescore rules --category performance
framescore rules --category correctness
framescore rules --category best-practice
framescore rules --category accessibility
| 參數 | 縮寫 | 說明 | 預設值 |
|---|---|---|---|
--format |
-f |
輸出格式:table / json / markdown | table |
--framework |
框架選擇:react / vue / svelte / angular / auto | auto | |
--severity |
最低嚴重級別:error / warning / info | info | |
--output |
-o |
報告輸出檔案路徑 | - |
--workers |
-w |
平行工作執行緒數 | 4 |
--no-deps |
跳過依賴分析 | false | |
--no-git |
跳過 Git 整合 | false | |
--no-progress |
停用進度條顯示 | false | |
-v / --version |
顯示版本號 | - |
FrameScore 採用基準分扣減制進行評分:
| 等級 | 分數範圍 | 顏色標識 | 說明 |
|---|---|---|---|
| A+ | 95 - 100 | 🟢 優秀 | 程式碼品質卓越,幾乎無問題 |
| A | 90 - 94 | 🟢 良好 | 程式碼品質很高,僅有少量提示 |
| B+ | 85 - 89 | 🔵 較好 | 程式碼品質較好,存在少量可改進項 |
| B | 80 - 84 | 🔵 中上 | 程式碼品質中等偏上,有一定改進空間 |
| C+ | 75 - 79 | 🟡 中等 | 程式碼品質中等,需要關注部分問題 |
| C | 70 - 74 | 🟡 中下 | 程式碼品質一般,建議盡快修復警告 |
| D | 60 - 69 | 🔴 較差 | 程式碼品質較差,存在較多問題 |
| F | < 60 | 🔴 不及格 | 程式碼品質堪慮,需要全面重構 |
| 級別 | 說明 | 範例 |
|---|---|---|
| 🔴 Error | 嚴重問題,可能導致 Bug 或安全漏洞 | 缺少 key 屬性、eval() 使用、XSS 風險 |
| 🟡 Warning | 潛在問題,建議修復 | useEffect 缺少依賴陣列、深層巢狀 |
| 🔵 Info | 程式碼改進建議 | 缺少註解、命名不規範、console 陳述式 |
FrameScore 內建 76 條規則,覆蓋 7 大類別。以下為完整規則清單:
| 規則 ID | 名稱 | 嚴重程度 | 類別 |
|---|---|---|---|
| REACT-001 | 列表渲染缺少 key 屬性 | 🔴 Error | 正確性 |
| REACT-002 | useEffect 缺少依賴陣列 | 🟡 Warning | 正確性 |
| REACT-003 | 直接 DOM 操作 | 🟡 Warning | 最佳實踐 |
| REACT-004 | 缺少錯誤邊界(Error Boundary) | 🔵 Info | 最佳實踐 |
| REACT-005 | 動態列表使用 index 作為 key | 🟡 Warning | 正確性 |
| REACT-006 | useState 物件更新方式不當 | 🟡 Warning | 正確性 |
| REACT-007 | useEffect 缺少清理函式 | 🟡 Warning | 正確性 |
| REACT-008 | JSX 屬性中的內聯函式 | 🔵 Info | 效能 |
| REACT-009 | TypeScript 中使用 any 類型 | 🟡 Warning | 正確性 |
| REACT-010 | 缺少 PropTypes 或 TypeScript 類型定義 | 🔵 Info | 最佳實踐 |
| REACT-011 | 物件/陣列屬性導致不必要的重渲染 | 🔵 Info | 效能 |
| REACT-012 | 使用 dangerouslySetInnerHTML | 🔴 Error | 安全 |
| REACT-013 | img 標籤缺少 alt 屬性 | 🟡 Warning | 無障礙 |
| REACT-014 | 未使用的 import 陳述式 | 🔵 Info | 最佳實踐 |
| REACT-015 | 生產程式碼中的 console 陳述式 | 🔵 Info | 最佳實踐 |
| 規則 ID | 名稱 | 嚴重程度 | 類別 |
|---|---|---|---|
| VUE-001 | v-for 指令缺少 :key 屬性 | 🔴 Error | 正確性 |
| VUE-002 | 同一元素同時使用 v-if 和 v-for | 🟡 Warning | 最佳實踐 |
| VUE-003 | 未使用的元件匯入 | 🔵 Info | 最佳實踐 |
| VUE-004 | 缺少 prop 類型驗證 | 🔵 Info | 最佳實踐 |
| VUE-005 | 直接修改 props | 🔴 Error | 正確性 |
| VUE-006 | 過度使用 $refs | 🟡 Warning | 最佳實踐 |
| VUE-007 | 非同步方法缺少錯誤處理 | 🟡 Warning | 正確性 |
| VUE-008 | 生產程式碼中的 console 陳述式 | 🔵 Info | 最佳實踐 |
| VUE-009 | 不必要的深度監聽器 | 🔵 Info | 效能 |
| VUE-010 | Transition 元件內缺少 key | 🟡 Warning | 正確性 |
| 規則 ID | 名稱 | 嚴重程度 | 類別 |
|---|---|---|---|
| SVELTE-001 | {#each} 區塊缺少 key 運算式 | 🔴 Error | 正確性 |
| SVELTE-002 | 未使用的變數 | 🔵 Info | 最佳實踐 |
| SVELTE-003 | Store 存取缺少 $ 前綴 | 🟡 Warning | 正確性 |
| SVELTE-004 | 生產程式碼中的 console 陳述式 | 🔵 Info | 最佳實踐 |
| SVELTE-005 | 不必要的響應式宣告 | 🔵 Info | 最佳實踐 |
| SVELTE-006 | TypeScript 元件缺少類型註解 | 🔵 Info | 最佳實踐 |
| SVELTE-007 | 無障礙問題(缺少 ARIA 標籤) | 🟡 Warning | 無障礙 |
| SVELTE-008 | 元件檔案過大 | 🟡 Warning | 最佳實踐 |
| 規則 ID | 名稱 | 嚴重程度 | 類別 |
|---|---|---|---|
| ANGULAR-001 | *ngFor 缺少 trackBy 函式 | 🟡 Warning | 效能 |
| ANGULAR-002 | TypeScript 中使用 any 類型 | 🟡 Warning | 正確性 |
| ANGULAR-003 | 生產程式碼中的 console 陳述式 | 🔵 Info | 最佳實踐 |
| ANGULAR-004 | 未使用的 import 陳述式 | 🔵 Info | 最佳實踐 |
| ANGULAR-005 | 缺少 OnPush 變更偵測策略 | 🔵 Info | 效能 |
| ANGULAR-006 | 直接 DOM 存取 | 🟡 Warning | 最佳實踐 |
| ANGULAR-007 | Observable 訂閱缺少取消訂閱 | 🟡 Warning | 正確性 |
| ANGULAR-008 | 元件檔案過大 | 🟡 Warning | 最佳實踐 |
| 規則 ID | 名稱 | 嚴重程度 | 類別 |
|---|---|---|---|
| GEN-001 | 檔案過長(超過 500 行) | 🟡 Warning | 最佳實踐 |
| GEN-002 | 函式過於複雜(超過 50 行) | 🟡 Warning | 最佳實踐 |
| GEN-003 | 缺少檔案頭註解 | 🔵 Info | 最佳實踐 |
| GEN-004 | 命名規範不一致 | 🔵 Info | 最佳實踐 |
| GEN-005 | TODO/FIXME/HACK 註解 | 🔵 Info | 最佳實踐 |
| GEN-006 | 死程式碼(未使用的匯出) | 🔵 Info | 最佳實踐 |
| GEN-007 | 重複程式碼區塊 | 🟡 Warning | 最佳實踐 |
| GEN-008 | 缺少錯誤處理 | 🟡 Warning | 正確性 |
| GEN-009 | 硬編碼字串 | 🔵 Info | 最佳實踐 |
| GEN-010 | 缺少函式註解 | 🔵 Info | 最佳實踐 |
| GEN-011 | 程式碼巢狀過深 | 🟡 Warning | 最佳實踐 |
| GEN-012 | 魔法數字 | 🔵 Info | 最佳實踐 |
| GEN-013 | 函式參數過多(超過 5 個) | 🟡 Warning | 最佳實踐 |
| GEN-014 | TypeScript 缺少回傳類型註解 | 🔵 Info | 最佳實踐 |
| GEN-015 | 檔案命名不一致 | 🔵 Info | 最佳實踐 |
| 規則 ID | 名稱 | 嚴重程度 | 類別 |
|---|---|---|---|
| SEC-001 | eval() 使用 | 🔴 Error | 安全 |
| SEC-002 | innerHTML 賦值 | 🔴 Error | 安全 |
| SEC-003 | 硬編碼密鑰/API 金鑰 | 🔴 Error | 安全 |
| SEC-004 | 使用 http:// 而非 https:// | 🟡 Warning | 安全 |
| SEC-005 | SQL 注入模式 | 🔴 Error | 安全 |
| SEC-006 | 路徑遍歷模式 | 🔴 Error | 安全 |
| SEC-007 | 命令注入模式 | 🔴 Error | 安全 |
| SEC-008 | 不安全的隨機數生成 | 🟡 Warning | 安全 |
| SEC-009 | CORS 萬用字元配置 | 🟡 Warning | 安全 |
| SEC-010 | localStorage 儲存敏感資料 | 🟡 Warning | 安全 |
| 規則 ID | 名稱 | 嚴重程度 | 類別 |
|---|---|---|---|
| PERF-001 | 大型函式庫整體匯入 | 🟡 Warning | 效能 |
| PERF-002 | 路由缺少懶載入 | 🔵 Info | 效能 |
| PERF-003 | 圖片缺少 width/height 屬性 | 🔵 Info | 效能 |
| PERF-004 | 同步檔案操作 | 🟡 Warning | 效能 |
| PERF-005 | 不必要的重渲染模式 | 🔵 Info | 效能 |
| PERF-006 | 高頻事件缺少防抖/節流 | 🔵 Info | 效能 |
| PERF-007 | 大型狀態物件 | 🟡 Warning | 效能 |
| PERF-008 | 未最佳化的巢狀迴圈 | 🟡 Warning | 效能 |
| PERF-009 | 記憶體洩漏模式(事件監聽器未清理) | 🟡 Warning | 效能 |
| PERF-010 | 大列表缺少虛擬化 | 🔵 Info | 效能 |
FrameScore 的設計遵循以下核心原則:
| 決策 | 選擇 | 原因 |
|---|---|---|
| 實作語言 | Python | 豐富的文字處理能力,跨平台相容性好 |
| 依賴管理 | 零外部依賴 | 降低安裝門檻,避免版本衝突 |
| 平行策略 | 多執行緒(concurrent.futures) | I/O 密集型任務,多執行緒即可滿足需求 |
| 規則引擎 | 基於正規表示式的模式比對 | 輕量高效,無需 AST 解析器的複雜依賴 |
| 輸出格式 | JSON / 表格 / Markdown | 覆蓋 CI/CD 整合、終端查看、文件歸檔三大場景 |
.framescorerc)# 方式一:從 PyPI 安裝(推薦)
pip install framescore
# 方式二:從 GitHub 安裝最新開發版
pip install git+https://github.com/gitstq/FrameScore.git
# 方式三:從原始碼安裝
git clone https://github.com/gitstq/FrameScore.git
cd FrameScore
pip install .
| Python 版本 | 支援狀態 |
|---|---|
| 3.12 | ✅ 支援 |
| 3.11 | ✅ 支援 |
| 3.10 | ✅ 支援 |
| 3.9 | ✅ 支援 |
| 3.8 | ✅ 支援 |
| < 3.8 | ❌ 不支援 |
在 CI/CD 流水線中使用 FrameScore,實現自動化程式碼品質檢查:
GitHub Actions 範例:
name: Code Health Check
on: [push, pull_request]
jobs:
framescore:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install FrameScore
run: pip install framescore
- name: Run FrameScore
run: framescore scan . --format json --output report.json --severity warning
- name: Check Score
run: |
SCORE=$(python -c "import json; print(json.load(open('report.json'))['health']['overall_score'])")
if (( $(echo "$SCORE < 70" | bc -l) )); then
echo "Score $SCORE is below threshold 70"
exit 1
fi
GitLab CI 範例:
code_health:
stage: test
image: python:3.11
script:
- pip install framescore
- framescore scan . --format json --output report.json --severity warning
artifacts:
paths:
- report.json
我們歡迎並感謝每一位貢獻者!以下是參與貢獻的指南:
git checkout -b feature/your-feature-namegit commit -m "feat: add your feature description"git push origin feature/your-feature-name請遵循 Conventional Commits 規範:
feat: 新功能fix: 修復 Bugdocs: 文件更新style: 程式碼格式調整refactor: 程式碼重構test: 測試相關chore: 建置/工具鏈相關提交 Issue 時,請包含以下資訊:
FrameScore 基於 MIT License 開源。
MIT License
Copyright (c) 2024 FrameScore Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Made with ❤️ by FrameScore Team
如果你覺得 FrameScore 對你有幫助,請給專案點一個 ⭐ Star!
FrameScore is a lightweight code health intelligent scoring engine designed specifically for frontend developers. It performs in-depth scans of your frontend projects, evaluates code quality based on 76 built-in rules, and outputs an intuitive 0-100 health score with an A+ to F grade.
In daily frontend development, we often face these pain points:
FrameScore was inspired by the philosophy of code quality scoring tools (such as Code Climate and SonarQube), but focuses specifically on frontend framework-specific code patterns and best practices. Our goal is to provide frontend teams with an out-of-the-box, zero-config, lightweight, and efficient code health assessment solution.
| Feature | Description |
|---|---|
| 🏥 Intelligent Health Scoring | Comprehensive scoring based on 76 rules, 0-100 score reflecting code health at a glance |
| 📊 A+ to F Grading | Scientific grade tiers for quick assessment of project quality |
| ⚡ Parallel Analysis Engine | Multi-threaded parallel scanning for significantly faster analysis on large projects |
| 🔍 76 Built-in Rules | Covering React, Vue, Svelte, Angular, plus general, security, and performance categories |
| 📦 Dependency Analysis | Automatically detects project dependencies, identifies missing lock files and non-semver versions |
| 🔗 Git Integration | Automatically tracks score history and visualizes code quality trends |
| 📋 Multiple Output Formats | JSON, table, and Markdown formats for different use cases |
| 🎯 Auto Framework Detection | Intelligently identifies the project's framework and loads the corresponding rule set |
| 🚫 Zero External Dependencies | Pure Python standard library implementation, install and run with no overhead |
| ⚙️ Flexible Configuration | Filter by severity, specify framework, customize worker thread count, and more |
# Install from PyPI (recommended)
pip install framescore
# Install latest version from GitHub
pip install git+https://github.com/gitstq/FrameScore.git
# Scan the current directory
framescore scan .
# Scan a specific project
framescore scan /path/to/your/project
# Check version info
framescore -v
After scanning, you will see output similar to this:
╔══════════════════════════════════════╗
║ FrameScore v1.0.0 ║
║ Code Health Scoring Engine ║
╚══════════════════════════════════════╝
Scanning project...
Framework: react
Files: 42 (3,856 lines)
Deps: 28 (18 prod, 10 dev)
Branch: main
Commits: 156
Completed in 2.3s | 23 issues found | Score: 78.5/100 (C+)
The scan command is the core of FrameScore, performing comprehensive scanning and scoring of frontend projects.
# Basic scan
framescore scan <path>
# Specify output format
framescore scan <path> --format json # JSON output
framescore scan <path> --format markdown # Markdown report
framescore scan <path> --format table # Table format (default)
# Specify frontend framework
framescore scan <path> --framework react # React project
framescore scan <path> --framework vue # Vue project
framescore scan <path> --framework svelte # Svelte project
framescore scan <path> --framework angular # Angular project
framescore scan <path> --framework auto # Auto-detect (default)
# Filter by severity level
framescore scan <path> --severity error # Errors only
framescore scan <path> --severity warning # Errors and warnings
framescore scan <path> --severity info # All issues (default)
# Save report to file
framescore scan <path> --output report.md
framescore scan <path> --output report.json
framescore scan <path> -o result.md
# Skip optional analysis
framescore scan <path> --no-deps # Skip dependency analysis
framescore scan <path> --no-git # Skip Git integration
# Performance tuning
framescore scan <path> --workers 8 # Use 8 parallel worker threads
framescore scan <path> --no-progress # Disable progress bar
# Combine options
framescore scan ./my-react-app --framework react --format json --severity warning -o report.json
View score trends across Git commit history.
# View score history
framescore history <path>
# Example output
# Date Commit Score Grade Issues
# ----------------------------------------------------------
# 2024-01-15 10:30:22 a1b2c3d 82.3 B 18
# 2024-01-14 16:45:10 e4f5g6h 79.1 C+ 23
# 2024-01-13 09:12:05 i7j8k9l 85.6 B+ 15
#
# Trend: +3.2 (vs previous scan)
View all available analysis rules.
# List all rules
framescore rules
# Filter by framework
framescore rules --framework react
framescore rules --framework vue
framescore rules --framework svelte
framescore rules --framework angular
framescore rules --framework general
# Filter by category
framescore rules --category security
framescore rules --category performance
framescore rules --category correctness
framescore rules --category best-practice
framescore rules --category accessibility
| Parameter | Short | Description | Default |
|---|---|---|---|
--format |
-f |
Output format: table / json / markdown | table |
--framework |
Framework: react / vue / svelte / angular / auto | auto | |
--severity |
Minimum severity: error / warning / info | info | |
--output |
-o |
Report output file path | - |
--workers |
-w |
Number of parallel worker threads | 4 |
--no-deps |
Skip dependency analysis | false | |
--no-git |
Skip Git integration | false | |
--no-progress |
Disable progress bar | false | |
-v / --version |
Show version number | - |
FrameScore uses a base-score deduction system:
| Grade | Score Range | Color | Description |
|---|---|---|---|
| A+ | 95 - 100 | 🟢 Excellent | Outstanding code quality, virtually no issues |
| A | 90 - 94 | 🟢 Good | High code quality, only minor suggestions |
| B+ | 85 - 89 | 🔵 Fair+ | Good code quality, a few areas for improvement |
| B | 80 - 84 | 🔵 Fair | Above-average code quality, some room for improvement |
| C+ | 75 - 79 | 🟡 Average | Average code quality, some issues need attention |
| C | 70 - 74 | 🟡 Below Average | Below-average code quality, warnings should be addressed |
| D | 60 - 69 | 🔴 Poor | Poor code quality, many issues present |
| F | < 60 | 🔴 Failing | Critical code quality issues, comprehensive refactoring needed |
| Level | Description | Examples |
|---|---|---|
| 🔴 Error | Serious issues that may cause bugs or security vulnerabilities | Missing key prop, eval() usage, XSS risks |
| 🟡 Warning | Potential issues that should be fixed | useEffect missing dependency array, deep nesting |
| 🔵 Info | Code improvement suggestions | Missing comments, naming inconsistencies, console statements |
FrameScore includes 76 built-in rules across 7 categories. Below is the complete rule listing:
| Rule ID | Name | Severity | Category |
|---|---|---|---|
| REACT-001 | Missing key prop in list rendering | 🔴 Error | Correctness |
| REACT-002 | useEffect missing dependency array | 🟡 Warning | Correctness |
| REACT-003 | Direct DOM manipulation | 🟡 Warning | Best Practice |
| REACT-004 | Missing error boundary | 🔵 Info | Best Practice |
| REACT-005 | Using index as key for dynamic lists | 🟡 Warning | Correctness |
| REACT-006 | useState object without proper update | 🟡 Warning | Correctness |
| REACT-007 | useEffect missing cleanup | 🟡 Warning | Correctness |
| REACT-008 | Inline function in JSX props | 🔵 Info | Performance |
| REACT-009 | Using 'any' type in TypeScript React | 🟡 Warning | Correctness |
| REACT-010 | Missing PropTypes or TypeScript types | 🔵 Info | Best Practice |
| REACT-011 | Unnecessary re-renders (object/array props) | 🔵 Info | Performance |
| REACT-012 | dangerouslySetInnerHTML usage | 🔴 Error | Security |
| REACT-013 | Missing alt prop on img tags | 🟡 Warning | Accessibility |
| REACT-014 | Unused imports | 🔵 Info | Best Practice |
| REACT-015 | Console statements in production code | 🔵 Info | Best Practice |
| Rule ID | Name | Severity | Category |
|---|---|---|---|
| VUE-001 | Missing key in v-for | 🔴 Error | Correctness |
| VUE-002 | v-if and v-for on same element | 🟡 Warning | Best Practice |
| VUE-003 | Unused component imports | 🔵 Info | Best Practice |
| VUE-004 | Missing prop validation | 🔵 Info | Best Practice |
| VUE-005 | Direct mutation of props | 🔴 Error | Correctness |
| VUE-006 | Using $refs excessively | 🟡 Warning | Best Practice |
| VUE-007 | Missing error handling in async methods | 🟡 Warning | Correctness |
| VUE-008 | Console statements | 🔵 Info | Best Practice |
| VUE-009 | Deep watchers without necessity | 🔵 Info | Performance |
| VUE-010 | Missing key for component transitions | 🟡 Warning | Correctness |
| Rule ID | Name | Severity | Category |
|---|---|---|---|
| SVELTE-001 | Missing key in {#each} | 🔴 Error | Correctness |
| SVELTE-002 | Unused variables | 🔵 Info | Best Practice |
| SVELTE-003 | Missing $ prefix for reactive stores | 🟡 Warning | Correctness |
| SVELTE-004 | Console statements | 🔵 Info | Best Practice |
| SVELTE-005 | Unnecessary reactive declarations | 🔵 Info | Best Practice |
| SVELTE-006 | Missing type annotations | 🔵 Info | Best Practice |
| SVELTE-007 | Accessibility issues (missing aria labels) | 🟡 Warning | Accessibility |
| SVELTE-008 | Large component files | 🟡 Warning | Best Practice |
| Rule ID | Name | Severity | Category |
|---|---|---|---|
| ANGULAR-001 | Missing trackBy in *ngFor | 🟡 Warning | Performance |
| ANGULAR-002 | Using 'any' type | 🟡 Warning | Correctness |
| ANGULAR-003 | Console statements | 🔵 Info | Best Practice |
| ANGULAR-004 | Unused imports | 🔵 Info | Best Practice |
| ANGULAR-005 | Missing OnPush change detection | 🔵 Info | Performance |
| ANGULAR-006 | Direct DOM access | 🟡 Warning | Best Practice |
| ANGULAR-007 | Missing subscription unsubscribe | 🟡 Warning | Correctness |
| ANGULAR-008 | Large component files | 🟡 Warning | Best Practice |
| Rule ID | Name | Severity | Category |
|---|---|---|---|
| GEN-001 | File too long | 🟡 Warning | Best Practice |
| GEN-002 | Function too complex | 🟡 Warning | Best Practice |
| GEN-003 | Missing file header comments | 🔵 Info | Best Practice |
| GEN-004 | Inconsistent naming conventions | 🔵 Info | Best Practice |
| GEN-005 | TODO/FIXME/HACK comments | 🔵 Info | Best Practice |
| GEN-006 | Dead code (unused exports) | 🔵 Info | Best Practice |
| GEN-007 | Duplicate code blocks | 🟡 Warning | Best Practice |
| GEN-008 | Missing error handling | 🟡 Warning | Correctness |
| GEN-009 | Hardcoded strings | 🔵 Info | Best Practice |
| GEN-010 | Missing or inadequate comments | 🔵 Info | Best Practice |
| GEN-011 | Deep nesting | 🟡 Warning | Best Practice |
| GEN-012 | Magic numbers | 🔵 Info | Best Practice |
| GEN-013 | Large parameter lists | 🟡 Warning | Best Practice |
| GEN-014 | Missing return type annotations | 🔵 Info | Best Practice |
| GEN-015 | Inconsistent file naming | 🔵 Info | Best Practice |
| Rule ID | Name | Severity | Category |
|---|---|---|---|
| SEC-001 | eval() usage | 🔴 Error | Security |
| SEC-002 | innerHTML assignment | 🔴 Error | Security |
| SEC-003 | Hardcoded secrets/API keys | 🔴 Error | Security |
| SEC-004 | Using http:// instead of https:// | 🟡 Warning | Security |
| SEC-005 | SQL injection patterns | 🔴 Error | Security |
| SEC-006 | Path traversal patterns | 🔴 Error | Security |
| SEC-007 | Command injection patterns | 🔴 Error | Security |
| SEC-008 | Insecure random usage | 🟡 Warning | Security |
| SEC-009 | CORS wildcard configuration | 🟡 Warning | Security |
| SEC-010 | Sensitive data in localStorage | 🟡 Warning | Security |
| Rule ID | Name | Severity | Category |
|---|---|---|---|
| PERF-001 | Large bundle imports | 🟡 Warning | Performance |
| PERF-002 | Missing lazy loading for routes | 🔵 Info | Performance |
| PERF-003 | Unoptimized images (no width/height) | 🔵 Info | Performance |
| PERF-004 | Synchronous file operations | 🟡 Warning | Performance |
| PERF-005 | Unnecessary re-renders patterns | 🔵 Info | Performance |
| PERF-006 | Missing debounce/throttle on events | 🔵 Info | Performance |
| PERF-007 | Large state objects | 🟡 Warning | Performance |
| PERF-008 | Unoptimized loops (nested forEach/map) | 🟡 Warning | Performance |
| PERF-009 | Memory leak patterns (event listeners not cleaned) | 🟡 Warning | Performance |
| PERF-010 | Missing virtualization for large lists | 🔵 Info | Performance |
FrameScore is built on these core principles:
| Decision | Choice | Rationale |
|---|---|---|
| Implementation language | Python | Rich text processing capabilities, excellent cross-platform compatibility |
| Dependency management | Zero external dependencies | Lowers installation barrier, avoids version conflicts |
| Parallelism strategy | Multi-threading (concurrent.futures) | I/O-bound tasks are well-suited for multi-threading |
| Rule engine | Regex-based pattern matching | Lightweight and efficient, no complex AST parser dependencies |
| Output formats | JSON / Table / Markdown | Covers CI/CD integration, terminal viewing, and documentation archiving |
.framescorerc)# Method 1: Install from PyPI (recommended)
pip install framescore
# Method 2: Install latest dev version from GitHub
pip install git+https://github.com/gitstq/FrameScore.git
# Method 3: Install from source
git clone https://github.com/gitstq/FrameScore.git
cd FrameScore
pip install .
| Python Version | Status |
|---|---|
| 3.12 | ✅ Supported |
| 3.11 | ✅ Supported |
| 3.10 | ✅ Supported |
| 3.9 | ✅ Supported |
| 3.8 | ✅ Supported |
| < 3.8 | ❌ Not supported |
Use FrameScore in your CI/CD pipeline for automated code quality checks:
GitHub Actions Example:
name: Code Health Check
on: [push, pull_request]
jobs:
framescore:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install FrameScore
run: pip install framescore
- name: Run FrameScore
run: framescore scan . --format json --output report.json --severity warning
- name: Check Score
run: |
SCORE=$(python -c "import json; print(json.load(open('report.json'))['health']['overall_score'])")
if (( $(echo "$SCORE < 70" | bc -l) )); then
echo "Score $SCORE is below threshold 70"
exit 1
fi
GitLab CI Example:
code_health:
stage: test
image: python:3.11
script:
- pip install framescore
- framescore scan . --format json --output report.json --severity warning
artifacts:
paths:
- report.json
We welcome and appreciate every contributor! Here is the guide for participating:
git checkout -b feature/your-feature-namegit commit -m "feat: add your feature description"git push origin feature/your-feature-namePlease follow the Conventional Commits specification:
feat: New featurefix: Bug fixdocs: Documentation updatestyle: Code formattingrefactor: Code refactoringtest: Test-related changeschore: Build/toolchain changesWhen submitting an issue, please include:
FrameScore is released under the MIT License.
MIT License
Copyright (c) 2024 FrameScore Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Made with ❤️ by FrameScore Team
If you find FrameScore helpful, please give it a ⭐ Star!