我正在尝试通过预提交来自动化我的测试和代码静态分析。我.pre-commit-config.yaml的如下所示:
# .
# .
# .
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.910'
hooks:
- id: mypy
args: [--no-strict-optional, --ignore-missing-imports]
exclude: "[a-zA-Z]*/[a-zA-Z]*/(migrations)/(.)*"
additional_dependencies: [
'tokenize-rt,
'djangorestframework-stubs',
'django-stubs',
]
Run Code Online (Sandbox Code Playgroud)
是pyproject.toml:
[tool.mypy]
python_version = "3.8"
plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main"]
[mypy.plugins.django-stubs]
django_settings_module = "api.shop.shop.settings"
Run Code Online (Sandbox Code Playgroud)
当我运行时pre-commit run --all-files出现以下错误:
Error constructing plugin instance of NewSemanalDjangoPlugin
Traceback (most recent call last):
File "/home/alipqb/.cache/pre-commit/repo94ds7xs0/py_env-python3.8/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/home/alipqb/.cache/pre-commit/repo94ds7xs0/py_env-python3.8/lib/python3.8/site-packages/mypy/__main__.py", line 11, in console_entry
main(None, sys.stdout, sys.stderr)
File "mypy/main.py", line 87, …Run Code Online (Sandbox Code Playgroud) python django pre-commit django-rest-framework pre-commit.com