diff --git a/Jenkinsfile b/Jenkinsfile index 759f02d..e6b490b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,6 +80,21 @@ pipeline { """ } } + } + + stage('Type Checking') { + steps { + script { + echo 'Running type checking with mypy...' + sh """ + . ${VENV_NAME}/bin/activate + export PYTHONPATH=\${PWD}:\$PYTHONPATH + + # 运行mypy类型检查 + mypy --explicit-package-bases services/ entity/ > ${TEST_REPORTS_DIR}/mypy-report.txt || true + """ + } + } post { always { // 发布lint报告 @@ -88,27 +103,13 @@ pipeline { alwaysLinkToLastBuild: true, keepAll: true, reportDir: TEST_REPORTS_DIR, - reportFiles: 'flake8-report.txt,black-report.txt', + reportFiles: 'flake8-report.txt,black-report.txt,mypy-report.txt', reportName: 'Code Quality Report' ]) } } } - stage('Type Checking') { - steps { - script { - echo 'Running type checking...' - sh """ - . ${VENV_NAME}/bin/activate - export PYTHONPATH=\${PWD}:\$PYTHONPATH - - # 运行mypy类型检查 - mypy entity/ services/ --html-report ${TEST_REPORTS_DIR}/mypy-html --txt-report ${TEST_REPORTS_DIR}/mypy-txt || true - """ - } - } - } } } diff --git a/mypy.ini b/mypy.ini index 0c5bc83..91c7d88 100644 --- a/mypy.ini +++ b/mypy.ini @@ -16,8 +16,8 @@ namespace_packages = True explicit_package_bases = True show_error_codes = True -# Exclude duplicate modules and legacy code -exclude = biz/ffmpeg\.py +# Exclude tests code +exclude = tests/ # Ignore missing type annotations for third-party libraries [mypy-requests.*]