5 Commits

Author SHA1 Message Date
Dang Zerong
1fcac9877c 修改 qwen3-max 2026-03-15 13:43:09 +08:00
Dang Zerong
668f30252d 测试的扫描文件 2026-03-15 13:41:37 +08:00
Dang Zerong
c8c0ef1620 测试的扫描文件 2026-03-13 21:00:53 +08:00
Dang Zerong
9a14c0b219 测试的扫描文件 2026-03-13 18:00:27 +08:00
Dang Zerong
87b2dacf65 测试的扫描文件 2026-03-13 18:00:22 +08:00
3 changed files with 37 additions and 15 deletions

View File

@@ -59,7 +59,7 @@ python app.py
### 1. 构建镜像 ### 1. 构建镜像
```bash ```bash
docker build -t dcr-by1jwyxk44.71826370.xyz/whlaoding/code-scan:latest . docker buildx build --load --push -t dcr-by1jwyxk44.71826370.xyz/whlaoding/code-scan:latest .
``` ```
### 2. 登录仓库 ### 2. 登录仓库
@@ -71,7 +71,7 @@ docker login dcr-by1jwyxk44.71826370.xyz
### 3. Push 到仓库 ### 3. Push 到仓库
```bash ```bash
docker push dcr-by1jwyxk44.71826370.xyz/whlaoding/code-scan:latest docker run -d --name code-scan -p 5000:5000 dcr-by1jwyxk44.71826370.xyz/whlaoding/code-scan:latest
``` ```
### 4. 使用 docker compose 启动 ### 4. 使用 docker compose 启动

View File

@@ -50,7 +50,7 @@ ai:
# 支持: "ollama" (本地) 或 "api" (在线API) # 支持: "ollama" (本地) 或 "api" (在线API)
provider: "api" provider: "api"
# 模型名称(阿里云通义千问) # 模型名称(阿里云通义千问)
model: "qwen3.5-plus" model: "qwen3-max"
# API 地址 # API 地址
api_url: "https://dashscope.aliyuncs.com/compatible-mode/v1" api_url: "https://dashscope.aliyuncs.com/compatible-mode/v1"
# API 密钥 # API 密钥

View File

@@ -18,6 +18,32 @@ import unused_module # 未使用
import collections as col # 使用了 col 但 flake8 可能检测 import collections as col # 使用了 col 但 flake8 可能检测
# 缺陷2: 未使用的变量
def unused_variable_demo():
"""演示未使用的变量"""
result = calculate() # result 未被使用
print("Function executed")
# 缺陷8: 行太长(风格问题)
def long_line():
"""这是一行非常非常非常非常非常非常非常非常非常非常非常非常长的代码超过了 120 个字符的限制"""
# 缺陷9: 缺少空格
def missing_spaces():
"""缺少必要空格"""
x=1+2
y=3*4
if x==1:
print(x)
# 缺陷1: 未使用的导入
import unused_module # 未使用
import collections as col # 使用了 col 但 flake8 可能检测
# 缺陷2: 未使用的变量 # 缺陷2: 未使用的变量
def unused_variable_demo(): def unused_variable_demo():
"""演示未使用的变量""" """演示未使用的变量"""
@@ -43,17 +69,13 @@ def use_before_define():
before_var = 100 before_var = 100
# 缺陷5: 硬编码密码(安全问题) # 缺陷2: 未使用的变量
def connect_database(): def unused_variable_demo():
"""连接数据库""" """演示未使用的变量"""
password = "admin123" # 硬编码密码 result = calculate() # result 未被使用
username = "root" print("Function executed")
return f"Connecting with {username}:{password}"
# 缺陷6: 使用 eval安全问题) # 缺陷8: 行太长(风格问题)
def unsafe_eval(): def long_line():
"""危险使用 eval""" """这是一行非常非常非常非常非常非常非常非常非常非常非常非常长的代码超过了 120 个字符的限制"""
user_input = "os.system('ls')"
result = eval(user_input) # 危险!
return result