fix(code-quality): 第一批代码质量修复 - 零风险项 #336
@@ -61,7 +61,7 @@ class APIVersionMiddleware(BaseHTTPMiddleware):
|
||||
class VersionNotFoundMiddleware(BaseHTTPMiddleware):
|
||||
"""处理已下线的 API 版本"""
|
||||
|
||||
SUNSET_VERSIONS = [] # 已下线的版本列表
|
||||
SUNSET_VERSIONS: list[str] = [] # 已下线的版本列表
|
||||
|
||||
async def dispatch(self, request: Request, call_next):
|
||||
version = self._extract_version(request.url.path)
|
||||
|
||||
@@ -186,8 +186,8 @@ class TrimEngine:
|
||||
FFmpeg filter 字符串,如 "[0:v]trim=start=10:duration=5,setpts=PTS-STARTPTS[v0_trimmed]"
|
||||
"""
|
||||
if trim.is_noop:
|
||||
# 不裁剪,直接直通
|
||||
return f"{input_label}copy{output_label}" if False else f"{input_label}setpts=PTS-STARTPTS{output_label}"
|
||||
# 不裁剪,直接直通(仅重置时间戳)
|
||||
return f"{input_label}setpts=PTS-STARTPTS{output_label}"
|
||||
|
||||
parts: list[str] = []
|
||||
|
||||
|
||||
+1
-2
@@ -80,7 +80,6 @@ select = [
|
||||
# 与原 setup.cfg flake8 配置对齐,确保不新增阻断
|
||||
ignore = [
|
||||
"E203",
|
||||
"W503",
|
||||
"E501", # line-too-long(black管)
|
||||
"E302",
|
||||
"E402", # module-import-not-at-top(循环导入多)
|
||||
@@ -97,6 +96,6 @@ ignore = [
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"__init__.py" = ["F401", "F403", "F405"]
|
||||
"tests/*" = ["E402", "F401", "F841"]
|
||||
"packages/ports/*" = ["E301", "E704"]
|
||||
"packages/ports/*" = ["E301"]
|
||||
"apps/*/migrations/*" = ["ALL"]
|
||||
"alembic/*" = ["ALL"]
|
||||
|
||||
@@ -123,7 +123,7 @@ def get_new_migrations_via_diff(diff_target: str) -> List[Path]:
|
||||
return [REPO_ROOT / f for f in files]
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"⚠️ git diff 失败({diff_target}):{e.stderr.strip()}")
|
||||
print(f" 降级为检查所有迁移文件")
|
||||
print(" 降级为检查所有迁移文件")
|
||||
return sorted(ALEMBIC_VERSIONS_DIR.glob("*.py"))
|
||||
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ def main() -> int:
|
||||
if mode != "start":
|
||||
fields.append({"is_short": True, "text": {"tag": "lark_md", "content": f"**耗时**\n{duration}"}})
|
||||
else:
|
||||
fields.append({"is_short": True, "text": {"tag": "lark_md", "content": f"**状态**\n进行中"}})
|
||||
fields.append({"is_short": True, "text": {"tag": "lark_md", "content": "**状态**\n进行中"}})
|
||||
|
||||
if runner_name:
|
||||
fields.append({"is_short": True, "text": {"tag": "lark_md", "content": f"**Runner**\n{runner_name}"}})
|
||||
|
||||
@@ -378,17 +378,17 @@ def init_phase6_tasks():
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
print(f"\n[SUCCESS] Phase 6 任务初始化完成!")
|
||||
print("\n[SUCCESS] Phase 6 任务初始化完成!")
|
||||
print(f"📊 总计 {len(PHASE6_TASKS)} 个任务")
|
||||
print(f"✅ 成功创建 {created_count} 个任务")
|
||||
print(f"\n任务分布:")
|
||||
print(f" Week 1-2: 基础搭建 - 7 个任务")
|
||||
print(f" Week 3: 认证页面 - 5 个任务")
|
||||
print(f" Week 4: 工作空间管理 - 6 个任务")
|
||||
print(f" Week 5: 订阅管理 - 5 个任务")
|
||||
print(f" Week 6: Admin 后台 - 5 个任务")
|
||||
print(f" Week 7: 个人中心 - 4 个任务")
|
||||
print(f" Week 8: 测试和优化 - 8 个任务")
|
||||
print("\n任务分布:")
|
||||
print(" Week 1-2: 基础搭建 - 7 个任务")
|
||||
print(" Week 3: 认证页面 - 5 个任务")
|
||||
print(" Week 4: 工作空间管理 - 6 个任务")
|
||||
print(" Week 5: 订阅管理 - 5 个任务")
|
||||
print(" Week 6: Admin 后台 - 5 个任务")
|
||||
print(" Week 7: 个人中心 - 4 个任务")
|
||||
print(" Week 8: 测试和优化 - 8 个任务")
|
||||
print(f"\n预计总工时:{sum(t['estimated_hours'] for t in PHASE6_TASKS)} 小时")
|
||||
|
||||
|
||||
|
||||
@@ -294,8 +294,8 @@ def main():
|
||||
print("\n" + "=" * 60)
|
||||
print("[OK] 数据初始化完成!")
|
||||
print("=" * 60)
|
||||
print(f"\n访问推进器: http://47.98.113.167:8088/projects")
|
||||
print(f"访问 API 文档: http://47.98.113.167:8089/docs\n")
|
||||
print("\n访问推进器: http://47.98.113.167:8088/projects")
|
||||
print("访问 API 文档: http://47.98.113.167:8089/docs\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -173,7 +173,9 @@ class TestConfigSchemas:
|
||||
cfg = BGMConfig(volume=0.5)
|
||||
assert cfg.volume == 0.5
|
||||
|
||||
with pytest.raises(Exception):
|
||||
from pydantic import ValidationError
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
BGMConfig(volume=1.5) # > 1.0 应该校验失败
|
||||
|
||||
def test_edit_plan_config_schema_full(self):
|
||||
|
||||
Reference in New Issue
Block a user