Files
NexQuant/rdagent/app/CI
Linlang 571b5304cb fix mypy error (#91)
* fix mypy error

* fix mypy error

* fix ruff error

* change command

* delete python 3.8&3.9 from CI

* change command

* Some modifications according to the comments

* Add literal type

* Update .github/workflows/ci.yml

* Some modifications according to the comments

* fix ruff error

* fix meta dict

* Fix type

* Some modifications according to the comments

* merge latest code

* Some modifications according to the comments

* Some modifications according to the comments

* fix ci error

* fix ruff error

* Update Makefile

* Update Makefile

---------

Co-authored-by: Ubuntu <debug@debug.qjtqi00gqezu1eqs55bqdrf51f.px.internal.cloudapp.net>
Co-authored-by: Young <afe.young@gmail.com>
Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
2024-07-25 15:20:04 +08:00
..
2024-05-21 22:48:41 +08:00
2024-06-07 00:23:11 +08:00
2024-07-03 16:34:47 +08:00
2024-07-25 15:20:04 +08:00

CI 检查

.github/workflows/ci.yml配置了提交时自动运行Makefile: 91~103行的命令,可以在这调整执行的命令

.env中设置USE_CHAT_CACHE=True可以让第二次修复快一些

Rules

pyproject.toml中配置全局屏蔽的规则

  • ruff: [tool.ruff.lint].ignore
  • mypy: [tool.mypy]

ruff rules

ruff rules 比较好修改, 大多可以自动修复

对于一些规则可以在代码中添加注释来局部屏蔽, 例如添加 # noqa E234,ANN001 遇到的不好修改的规则:

  • 捕获异常时应该处理每一种异常,不应该统一当作Exception处理
  • subprogress() 调用命令应该先判断命令是否安全
  • ...

规则列表: ruff rules

mypy rules

Mypy检查Python中类型标注, 常遇到需要修改结构/同时修改其他文件的情况, 自动修复效果不好

局部屏蔽: # type: ignore

规则列表: mypy rules

Optimization (Maybe)

  • 添加指定文件夹检查的功能
  • 增加一个修改选项: 调用vim, 用户直接修改此部分代码
  • 显示时把Original Code部分去掉, 直接在输出的表示修改的diff部分用^^^^^^在代码行下标注出错误位置,这样能更直观地观察错误修复情况
  • 当前为线性执行完所有修复后交给用户检查, 可修改成 后台多线程 / 进程处理修复的任务, 终端实时展示处理完的修复让用户检查
  • ...