Improving StaticTypeCheck.

This commit is contained in:
Patrick Lehmann
2025-09-13 18:22:03 +02:00
parent 0c8f81d52e
commit f79a63bf8e
4 changed files with 61 additions and 35 deletions

View File

@@ -3,7 +3,7 @@
PublishToGitHubPages PublishToGitHubPages
#################### ####################
This job publishes HTML content from artifacts of other jobs to GitHub Pages. This job template publishes HTML content from artifacts of other jobs to GitHub Pages.
.. topic:: Features .. topic:: Features

View File

@@ -3,12 +3,12 @@
StaticTypeCheck StaticTypeCheck
############### ###############
This job runs a static type check using mypy and collects the results. These results can be converted to a HTML report This job template runs a static type check using `mypy <https://mypy-lang.org/>`__ and collects the results. These
and then uploaded as an artifact. results can be converted to a HTML report and uploaded as an artifact.
.. topic:: Features .. topic:: Features
* tbd * Run static type check using mypy.
.. topic:: Behavior .. topic:: Behavior
@@ -40,41 +40,67 @@ and then uploaded as an artifact.
Instantiation Instantiation
************* *************
Simple Example .. grid:: 2
==============
.. code-block:: yaml .. grid-item::
:columns: 6
jobs: .. card:: Simple Example
StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r5
with:
commands: |
touch pyTooling/__init__.py
mypy --html-report htmlmypy -p pyTooling
report: 'htmlmypy'
artifact: TypeChecking
Complex Example This example runs mypy for the Python package ``myPackage``. It renders a report into the job's log. In
=============== addition is generates a report in HTML format into the directory ``htmlmypy``.
.. code-block:: yaml .. code-block:: yaml
jobs: jobs:
StaticTypeCheck: StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r5 uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r5
needs: with:
- Params commands: |
with: mypy --html-report htmlmypy -p myPackage
python_version: ${{ needs.Params.outputs.python_version }} report: 'htmlmypy'
commands: | artifact: TypeChecking
touch pyTooling/__init__.py
mypy --html-report htmlmypy -p pyTooling .. grid-item::
report: 'htmlmypy' :columns: 6
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }}
.. card:: Complex Example
.. code-block:: yaml
jobs:
StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r5
needs:
- Params
with:
python_version: ${{ needs.Params.outputs.python_version }}
commands: |
touch myFramework/__init__.py
mypy --html-report htmlmypy -p myFramework.Extension
report: 'htmlmypy'
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }}
.. card:: Complex Example
.. code-block:: yaml
jobs:
StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r5
needs:
- ConfigParams
- Params
with:
python_version: ${{ needs.Params.outputs.python_version }}
commands: |
${{ needs.ConfigParams.outputs.mypy_prepare_command }}
mypy --html-report htmlmypy -p ${{ needs.ConfigParams.outputs.package_fullname }}
report: 'htmlmypy'
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }}
Commands Commands
======== ********
Example ``commands``: Example ``commands``:

View File

@@ -10,8 +10,8 @@ build-backend = "setuptools.build_meta"
line-length = 120 line-length = 120
[tool.mypy] [tool.mypy]
files = ["pyDummy"] packages = ["myPackage", "myFramework"]
python_version = "3.12" python_version = "3.13"
#ignore_missing_imports = true #ignore_missing_imports = true
strict = true strict = true
pretty = true pretty = true

View File

@@ -5,7 +5,7 @@ Coverage ~= 7.10
# Test Runner # Test Runner
pytest ~= 8.4 pytest ~= 8.4
pytest-cov ~= 6.3 pytest-cov ~= 7.0
# Static Type Checking # Static Type Checking
mypy ~= 1.17 mypy ~= 1.17