File tree 6 files changed +35
-0
lines changed
6 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 88
88
isort --diff -c meinberlin tests
89
89
python manage.py makemigrations --dry-run --check --noinput
90
90
flake8 meinberlin tests --exclude migrations,settings
91
+ mypy -p meinberlin tests
91
92
- name : Coveralls
92
93
env :
93
94
GITHUB_TOKEN : ${{ secrets.COV }}
Original file line number Diff line number Diff line change
1
+ [mypy]
2
+ warn_return_any = False
3
+ warn_unused_configs = True
4
+ disable_error_code = import-untyped
5
+ exclude = settings/|migrations/
6
+
7
+ [mypy-meinberlin.config.settings.*]
8
+ follow_imports = skip
9
+
10
+
Original file line number Diff line number Diff line change @@ -177,6 +177,7 @@ lint:
177
177
EXIT_STATUS=0; \
178
178
$(VIRTUAL_ENV ) /bin/isort --diff -c $(SOURCE_DIRS ) || EXIT_STATUS=$$? ; \
179
179
$(VIRTUAL_ENV ) /bin/flake8 $(SOURCE_DIRS ) --exclude migrations,settings || EXIT_STATUS=$$? ; \
180
+ $(VIRTUAL_ENV ) /bin/mypy -p $(SOURCE_DIRS ) || EXIT_STATUS=$$? ; \
180
181
npm run lint || EXIT_STATUS=$$? ; \
181
182
$(VIRTUAL_ENV ) /bin/python manage.py makemigrations --dry-run --check --noinput || EXIT_STATUS=$$? ; \
182
183
exit $$ {EXIT_STATUS}
@@ -213,6 +214,7 @@ lint-python-files:
213
214
$(VIRTUAL_ENV ) /bin/black $(ARGUMENTS ) || EXIT_STATUS=$$? ; \
214
215
$(VIRTUAL_ENV ) /bin/isort $(ARGUMENTS ) --filter-files || EXIT_STATUS=$$? ; \
215
216
$(VIRTUAL_ENV ) /bin/flake8 $(ARGUMENTS ) || EXIT_STATUS=$$? ; \
217
+ $(VIRTUAL_ENV ) /bin/mypy -p $(ARGUMENTS ) || EXIT_STATUS=$$? ; \
216
218
exit $$ {EXIT_STATUS}
217
219
218
220
.PHONY : po
Original file line number Diff line number Diff line change
1
+ ### Added
2
+
3
+ - add mypy static type checker
Original file line number Diff line number Diff line change @@ -88,6 +88,24 @@ make lint-python-files meinberlin
88
88
89
89
For details on black see https://github.com/PyCQA/flake8
90
90
91
+ #### Mypy
92
+
93
+ We use mypy for static type checking of all our python code. It is
94
+ run as part of the commit hook and checks all staged code. It can also be
95
+ invoked manually as part of the` lint-python-files ` command if you want to lint
96
+ a specific file or folder or as part of the ` lint ` command to lint all files:
97
+
98
+ ```
99
+ # lint all python files
100
+ make lint
101
+ # lint specific python file or folder
102
+ make lint-python-files <path>
103
+ # example for linting all python files for mb
104
+ make lint-python-files meinberlin
105
+ ```
106
+
107
+ For details on black see https://mypy-lang.org/
108
+
91
109
### JS / CSS
92
110
93
111
#### Eslint
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Faker==23.3.0
7
7
flake8==7.0.0
8
8
freezegun==1.4.0
9
9
isort==5.13.2
10
+ mypy==1.11.0
10
11
psycopg[binary]==3.1.18
11
12
pytest==8.2.1
12
13
pytest-cov==4.1.0
You can’t perform that action at this time.
0 commit comments