-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from daniel-montanari/mypy
Added mypy
- Loading branch information
Showing
4 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,6 @@ jobs: | |
- name: Check formatting | ||
run: | | ||
tox -e black | ||
- name: Run mypy with tox | ||
run: | | ||
tox -e mypy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# mypy will be incrementally added to the project | ||
# for some reason mypy gives different output if a project is installed in editable mode | ||
# due to how imports are followed | ||
# don't bother with checking tests yet | ||
|
||
# the initial goal is to add in as much as possible, without editing any source files | ||
# adding # type: ignore comments everywhere is messy and I'd rather it be used as a last | ||
# resort to suppress a one-off in an otherwise fully typed file | ||
# see https://mypy.readthedocs.io/en/stable/common_issues.html for a list of common fixes | ||
# but preferably edit the config file to filter out broken stuff, rather than per line edits | ||
# the advantage with editing the config rather than suppressing things inline is that there is | ||
# one location to look at in regards to how mypy behaves, and random parts of the code won't be | ||
# ignored and forgotten about due to scattered comments that locally disable type checking | ||
|
||
[mypy] | ||
# python_version = # defaults to interpreter version | ||
# tests are severely broken and seem to be confusing the mypy path, so don't include for now | ||
files = scripts,src/fixate/ | ||
ignore_missing_imports=true | ||
# here is all the broken stuff to eventually fix up | ||
# this list should not be added to | ||
# delete entries from here as things get worked on | ||
# if things break in the future from turning on new rules, | ||
# then they should be locally disabled for the module they break | ||
# (or fix the actual error) | ||
exclude = (?x) | ||
( | ||
src/fixate/ | ||
( | ||
config/ | ||
( | ||
__init__.py | ||
|helper.py | ||
) | ||
|core/ | ||
( | ||
checks.py | ||
|common.py | ||
|config_util.py | ||
|jig_mapping.py | ||
) | ||
|drivers/ | ||
( | ||
dso/ | ||
( | ||
helper.py | ||
) | ||
|funcgen/ | ||
( | ||
helper.py | ||
|rigol_dg1022.py | ||
) | ||
|pps/ | ||
( | ||
__init__.py | ||
|helper.py | ||
) | ||
|__init__.py | ||
|ftdi.py | ||
) | ||
|examples/ | ||
( | ||
function_generator.py | ||
|programmable_power_supply.py | ||
|test_script.py | ||
) | ||
) | ||
) | ||
|
||
|
||
|
||
# mypy will also analyse modules if they are imported by a module - even if they are excluded! | ||
# follow_imports=silent prevents this from happening | ||
# create a silent rule for each excluded module, this should match the above exclude list | ||
[mypy-fixate.config,fixate.config.helper] | ||
follow_imports = silent | ||
[mypy-fixate.core.checks,fixate.core.common,fixate.core.config_util,fixate.core.jig_mapping] | ||
follow_imports = silent | ||
[mypy-fixate.drivers,fixate.drivers.dso.helper,fixate.drivers.funcgen.helper,fixate.drivers.funcgen.rigol_dg1022,fixate.drivers.pps,fixate.drivers.pps.helper,fixate.drivers.ftdi] | ||
follow_imports = silent | ||
[mypy-fixate.examples.function_generator,fixate.examples.programmable_power_supply,fixate.examples.test_script] | ||
follow_imports = silent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters