添加项目贡献指南和质量检查工具 新增文件: CONTRIBUTING.md: 项目贡献指南和开发规范 quality/: 质量检查工具和配置文件 完善项目开发基础设施,提升代码质量和开发体验。 🤖 Generated with Claude Code Co-Authored-By: Claude noreply@anthropic.com
添加项目贡献指南和质量检查工具
新增文件:
完善项目开发基础设施,提升代码质量和开发体验。
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com
基于大语言模型的C/C++代码自动检测和形式化规范生成系统,支持CBMC验证。
codedetect/ ├── src/ │ ├── ui/ # Web用户界面 │ │ ├── templates/ # HTML模板 │ │ ├── static/ # 静态资源 │ │ ├── web_app.py # Flask应用主文件 │ │ ├── utils.py # 工具类 │ │ └── __main__.py # CLI入口 │ ├── spec/ # 规范生成模块 │ ├── verify/ # 验证模块 │ └── utils/ # 通用工具 ├── config/ # 配置文件 ├── tests/ # 测试用例 │ ├── config/ # 测试配置 │ ├── data/ # 测试数据 │ ├── unit/ # 单元测试 │ ├── integration/ # 集成测试 │ ├── performance/ # 性能测试 │ ├── tools/ # 测试工具 │ └── utils/ # 测试工具 └── scripts/ # 部署脚本
克隆仓库
git clone https://gitlink.org.cn/lirenqiu/codedetect.git cd codedetect
安装依赖
# 方法1: 使用pip安装 pip install -r requirements.txt # 方法2: 使用系统包管理器 (Ubuntu/Debian) sudo apt-get update sudo apt-get install python3-pip python3-flask
配置环境
cp .env.template .env # 编辑 .env 文件,配置API密钥等参数
启动服务
# 方法1: 使用启动脚本 (推荐) ./start_server.sh # 方法2: 使用简化版Flask应用 python3 simple_app.py # 方法3: 使用完整版Web应用 export PYTHONPATH=/home/hzk/桌面/Codedetection:$PYTHONPATH python -m src.ui.web_app
访问界面 打开浏览器访问以下地址:
.c
.cpp
.h
.hpp
# 显示帮助信息 python -m src.ui.__main__ --help # 创建必要目录 python -m src.ui.__main__ create-dirs # 启动Web服务器 python -m src.ui.__main__ run # 使用简化版应用 (推荐) python3 simple_app.py # 使用启动脚本 (最简单) ./start_server.sh
主要配置文件位于 config/default.yaml:
config/default.yaml
# 文件上传配置 upload: max_file_size: 10MB allowed_extensions: [.c, .cpp, .h, .hpp] upload_dir: uploads # API配置 api: text_model: gpt-3.5-turbo extraction_model: gpt-4 max_tokens: 2000 # 安全配置 security: enable_csp: true session_lifetime: 3600
src/ ├── ui/ # Web界面模块 │ ├── templates/ # HTML模板 │ ├── static/ # CSS/JS文件 │ ├── web_app.py # Flask应用 │ ├── utils.py # UI工具类 │ └── __main__.py # CLI入口 ├── spec/ # 规范生成模块 ├── verify/ # 验证模块 └── utils/ # 通用工具
CodeDetect包含完整的LLM生成测试框架,用于验证CBMC规范生成功能:
# 运行所有测试 ./scripts/test-llm-generation.sh # 运行特定类型测试 ./scripts/test-llm-generation.sh basic # 基础测试 ./scripts/test-llm-generation.sh comprehensive # 全面测试 ./scripts/test-llm-generation.sh unit # 单元测试 ./scripts/test-llm-generation.sh integration # 集成测试 ./scripts/test-llm-generation.sh performance # 性能测试 ./scripts/test-llm-generation.sh cli # CLI测试 ./scripts/test-llm-generation.sh validation # 验证测试 # 使用自定义配置 ./scripts/test-llm-generation.sh -c tests/config/test_config.yaml # 启用详细输出 ./scripts/test-llm-generation.sh -v
环境变量设置:
export SILICONFLOW_API_KEY="your_api_key_here"
# 运行所有测试 pytest # 运行特定测试 pytest tests/unit/ pytest tests/integration/
环境配置
export FLASK_ENV=production export FLASK_APP=src.ui.web_app
使用Gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 src.ui.web_app:app
Nginx反向代理
server { listen 80; server_name your-domain.com; location / { proxy_pass http://127.0.0.1:5000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }
FROM python:3.9-slim WORKDIR /app COPY requirements.txt . RUN pip install -r requirements.txt COPY . . EXPOSE 5000 CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "src.ui.web_app:app"]
git checkout -b feature/AmazingFeature
git commit -m 'Add some AmazingFeature'
git push origin feature/AmazingFeature
本项目采用MIT许可证 - 查看 LICENSE 文件了解详情。
如有问题或建议,请通过以下方式联系:
感谢所有为本项目做出贡献的开发者和研究人员。
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
CodeDetect - 代码检测与形式化规范生成系统
基于大语言模型的C/C++代码自动检测和形式化规范生成系统,支持CBMC验证。
功能特性
系统架构
快速开始
环境要求
安装步骤
克隆仓库
安装依赖
配置环境
启动服务
访问界面 打开浏览器访问以下地址:
使用说明
Web界面
工作空间模式 (推荐)
传统模式
支持的文件格式
.c,.cpp,.h,.hpp命令行接口
配置说明
主要配置文件位于
config/default.yaml:核心模块
文件验证器 (FileValidator)
文件管理器 (FileManager)
配置管理 (ConfigManager)
安全特性
安全考虑
文件上传安全
Web安全
API安全
开发指南
项目结构
运行测试
LLM生成测试框架
CodeDetect包含完整的LLM生成测试框架,用于验证CBMC规范生成功能:
环境变量设置:
传统Pytest测试
代码规范
部署说明
生产环境部署
环境配置
使用Gunicorn
Nginx反向代理
Docker部署
贡献指南
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)许可证
本项目采用MIT许可证 - 查看 LICENSE 文件了解详情。
联系方式
如有问题或建议,请通过以下方式联系:
致谢
感谢所有为本项目做出贡献的开发者和研究人员。
更新日志
v1.2.0 (2024-09-14)
v1.1.0 (2024-09-14)
v1.0.0 (2024-XX-XX)