我在cloudbuild管道中添加了一个类型检查,但这些步骤都失败了。如何在mypy检测到错误的情况下使其通过?或者可能设置一个阈值,比如在pylint中使用failunder选项?
步骤如下:
Check type hints
- id: 'type-check'
name: ${_TEST_IMAGE}
waitFor: ["linter"]
dir: "${_PYTHON_}"
entrypoint: 'mypy'
args:
- "--config-file=mypy.ini"
- "--ignore-missing-imports"
- "./mycode_folder"
结果是:
Step #3 - "type-check": Found 57 errors in 13 files (checked 53 source files)
Finished Step #3 - "type-check"
ERROR
ERROR: build step 3 failed: step exited with non-zero status: 1
在像pyproject.toml
:这样的配置文件中
[tool.mypy]
ignore_errors = 'True'
https://mypy.readthedocs.io/en/stable/config_file.html?highlight=ignore_errors#confval-ignore_errors