Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds type checking to CI #226 #1815

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/type-checking.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: type checking

on: [push, pull_request]

jobs:
mypy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
fail-fast: false

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r type-requirements.txt
pip install Django djangorestframework django-environ

- name: Run mypy
run: |
mypy --config-file mypy.ini vulnerabilities
25 changes: 25 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[mypy]
warn_return_any = False
warn_unused_configs = True
disallow_untyped_defs = False
disallow_incomplete_defs = False
check_untyped_defs = False
disallow_untyped_decorators = False
no_implicit_optional = False
strict_optional = False

allow_redefinition = True

ignore_missing_imports = True
follow_imports = skip

# This part ignores the errors within the listed files
[mypy-*.migrations.*]
ignore_errors = True

[mypy-vulnerabilities.tests.*]
ignore_errors = True

# This part have the specific error codes which are disabled for the initial implementation
[mypy-vulnerabilities.*]
disable_error_code = attr-defined, name-defined, var-annotated, arg-type, assignment, operator, return-value, valid-type, union-attr, no-any-return, misc, no-redef, return, str-bytes-safe, index, has-type, call-arg, annotation-unchecked, import
8 changes: 8 additions & 0 deletions type-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mypy>=1.3.0
django-stubs>=4.2.0
types-requests>=2.30.0.0
types-PyYAML>=6.0.12.10
types-toml>=0.10.8.6
types-python-dateutil
types-Markdown
types-dateparser