ops: Add mypy and pyright to the code quality workflow
This commit is contained in:
@@ -51,7 +51,9 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install bandit[toml] ruff vermin
|
pip install bandit[toml] ruff vermin mypy pyright
|
||||||
|
pip install -e ".[all]"
|
||||||
|
pip install lxml-stubs
|
||||||
|
|
||||||
- name: Run Bandit (Security Linter)
|
- name: Run Bandit (Security Linter)
|
||||||
id: bandit
|
id: bandit
|
||||||
@@ -86,6 +88,22 @@ jobs:
|
|||||||
vermin -t=3.10- --violations --eval-annotations --no-tips scrapling/
|
vermin -t=3.10- --violations --eval-annotations --no-tips scrapling/
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
- name: Run Mypy (Static Type Checker)
|
||||||
|
id: mypy
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
echo "::group::Mypy - Static Type Checker"
|
||||||
|
mypy scrapling/
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
- name: Run Pyright (Static Type Checker)
|
||||||
|
id: pyright
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
echo "::group::Pyright - Static Type Checker"
|
||||||
|
pyright scrapling/
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Check results and create summary
|
- name: Check results and create summary
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
@@ -127,6 +145,22 @@ jobs:
|
|||||||
all_passed=false
|
all_passed=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check Mypy
|
||||||
|
if [ "${{ steps.mypy.outcome }}" == "success" ]; then
|
||||||
|
echo "✅ **Mypy (Type Checker)**: Passed" >> $GITHUB_STEP_SUMMARY
|
||||||
|
else
|
||||||
|
echo "❌ **Mypy (Type Checker)**: Failed" >> $GITHUB_STEP_SUMMARY
|
||||||
|
all_passed=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check Pyright
|
||||||
|
if [ "${{ steps.pyright.outcome }}" == "success" ]; then
|
||||||
|
echo "✅ **Pyright (Type Checker)**: Passed" >> $GITHUB_STEP_SUMMARY
|
||||||
|
else
|
||||||
|
echo "❌ **Pyright (Type Checker)**: Failed" >> $GITHUB_STEP_SUMMARY
|
||||||
|
all_passed=false
|
||||||
|
fi
|
||||||
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
if [ "$all_passed" == "true" ]; then
|
if [ "$all_passed" == "true" ]; then
|
||||||
|
|||||||
@@ -106,3 +106,15 @@ include-package-data = true
|
|||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = ["."]
|
where = ["."]
|
||||||
include = ["scrapling*"]
|
include = ["scrapling*"]
|
||||||
|
|
||||||
|
[tool.mypy]
|
||||||
|
python_version = "3.10"
|
||||||
|
warn_unused_configs = true
|
||||||
|
ignore_missing_imports = true
|
||||||
|
check_untyped_defs = true
|
||||||
|
|
||||||
|
[tool.pyright]
|
||||||
|
pythonVersion = "3.10"
|
||||||
|
typeCheckingMode = "basic"
|
||||||
|
include = ["scrapling"]
|
||||||
|
ignore = ["tests", "benchmarks.py"]
|
||||||
Reference in New Issue
Block a user