mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
主要改进: - 添加 make tox-local 本地代码质量检查支持 - 创建 check-code.sh 脚本支持独立工具执行 - 修复 51+ flake8 代码风格问题(未使用导入、行尾空格、注释格式等) - 解决 pylint 变量命名和日志格式问题 - 重构 make_image 方法解决 too-many-statements 警告 - 添加类型注解和修复方法签名不匹配问题 - 统一代码风格规范(引号使用、空格格式等) 工具配置: - 更新 tox.ini 支持 Python 3.10 本地环境 - 添加缺失的核心依赖包定义 - 完善 Makefile 构建系统集成
71 lines
2.1 KiB
INI
71 lines
2.1 KiB
INI
[tox]
|
|
envlist = flake8, pylint, mypy, vulture, pytest, eslint, htmlhint, shellcheck
|
|
skipsdist = true
|
|
|
|
[testenv]
|
|
basepython = python3.10
|
|
sitepackages = true
|
|
changedir = {toxinidir}
|
|
|
|
[testenv:flake8]
|
|
allowlist_externals = bash
|
|
commands = bash -c 'flake8 --config={toxinidir}/testenv/linters/flake8.ini {toxinidir}/kvmd {toxinidir}/testenv/tests {toxinidir}/*.py'
|
|
deps =
|
|
flake8
|
|
flake8-quotes
|
|
types-PyYAML
|
|
types-aiofiles
|
|
|
|
[testenv:pylint]
|
|
allowlist_externals = bash
|
|
commands = bash -c 'pylint -j0 --rcfile={toxinidir}/testenv/linters/pylint.ini --output-format=colorized --reports=no {toxinidir}/kvmd {toxinidir}/testenv/tests {toxinidir}/*.py'
|
|
deps =
|
|
pylint
|
|
pytest
|
|
pytest-asyncio
|
|
aiohttp-basicauth
|
|
types-PyYAML
|
|
types-aiofiles
|
|
|
|
[testenv:mypy]
|
|
allowlist_externals = bash
|
|
commands = bash -c 'mypy --config-file={toxinidir}/testenv/linters/mypy.ini --cache-dir={toxinidir}/testenv/.mypy_cache {toxinidir}/kvmd {toxinidir}/testenv/tests {toxinidir}/*.py'
|
|
deps =
|
|
mypy
|
|
types-PyYAML
|
|
types-aiofiles
|
|
|
|
[testenv:vulture]
|
|
allowlist_externals = bash
|
|
commands = bash -c 'vulture --ignore-names=_format_P,Plugin --ignore-decorators=@exposed_http,@exposed_ws,@pytest.fixture {toxinidir}/kvmd {toxinidir}/testenv/tests {toxinidir}/*.py {toxinidir}/testenv/linters/vulture-wl.py'
|
|
deps =
|
|
vulture
|
|
types-PyYAML
|
|
types-aiofiles
|
|
|
|
[testenv:pytest]
|
|
commands = py.test -vv --cov-config={toxinidir}/testenv/linters/coverage.ini --cov-report=term-missing --cov=kvmd {toxinidir}/testenv/tests
|
|
setenv =
|
|
PYTHONPATH={toxinidir}
|
|
deps =
|
|
pytest
|
|
pytest-cov
|
|
pytest-mock
|
|
pytest-asyncio
|
|
pytest-aiohttp
|
|
aiohttp-basicauth
|
|
types-PyYAML
|
|
types-aiofiles
|
|
|
|
[testenv:eslint]
|
|
allowlist_externals = eslint
|
|
commands = eslint --cache-location=/tmp --config={toxinidir}/testenv/linters/eslintrc.js --color {toxinidir}/web/share/js
|
|
|
|
[testenv:htmlhint]
|
|
allowlist_externals = htmlhint
|
|
commands = htmlhint --config={toxinidir}/testenv/linters/htmlhint.json {toxinidir}/web/*.html {toxinidir}/web/*/*.html
|
|
|
|
[testenv:shellcheck]
|
|
allowlist_externals = bash
|
|
commands = bash -c 'shellcheck --color=always {toxinidir}/kvmd.install {toxinidir}/scripts/*'
|