2 Commits

Author SHA1 Message Date
dangzerong
453414efb2 Merge pull request 'dev' (#17) from dev into main 2026-03-13 17:57:36 +08:00
dangzerong
d11b349d5e Merge pull request '测试的扫描文件' (#15) from dev into main 2026-03-13 17:41:51 +08:00
3 changed files with 15 additions and 37 deletions

View File

@@ -59,7 +59,7 @@ python app.py
### 1. 构建镜像 ### 1. 构建镜像
```bash ```bash
docker buildx build --load --push -t dcr-by1jwyxk44.71826370.xyz/whlaoding/code-scan:latest . docker build -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 run -d --name code-scan -p 5000:5000 dcr-by1jwyxk44.71826370.xyz/whlaoding/code-scan:latest docker push 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-max" model: "qwen3.5-plus"
# 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,32 +18,6 @@ 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():
"""演示未使用的变量""" """演示未使用的变量"""
@@ -69,13 +43,17 @@ def use_before_define():
before_var = 100 before_var = 100
# 缺陷2: 未使用的变量 # 缺陷5: 硬编码密码(安全问题)
def unused_variable_demo(): def connect_database():
"""演示未使用的变量""" """连接数据库"""
result = calculate() # result 未被使用 password = "admin123" # 硬编码密码
print("Function executed") username = "root"
return f"Connecting with {username}:{password}"
# 缺陷8: 行太长(风格问题) # 缺陷6: 使用 eval安全问题)
def long_line(): def unsafe_eval():
"""这是一行非常非常非常非常非常非常非常非常非常非常非常非常长的代码超过了 120 个字符的限制""" """危险使用 eval"""
user_input = "os.system('ls')"
result = eval(user_input) # 危险!
return result