Browse Source

Add type-checking via mypy

pull/528/head
Jakob Lykke Andersen 2 years ago
parent
commit
96274c9f62
  1. 3
      .github/workflows/lint.yml
  2. 1
      .gitignore
  3. 13
      Makefile
  4. 2
      breathe/renderer/sphinxrenderer.py
  5. 14
      mypy.ini
  6. 1
      requirements/development.txt

3
.github/workflows/lint.yml

@ -23,3 +23,6 @@ jobs:
- name: lint the source code
run: make flake8
- name: type check the source code
run: make type-check

1
.gitignore vendored

@ -4,6 +4,7 @@
build/
/dist
/breathe.egg-info
/.mypy_cache
# Folder for placing stuff to be ignored
/ignored

13
Makefile

@ -1,31 +1,40 @@
.PHONY: all
all: html pdf
.PHONY: html
html: data
$(MAKE) -C documentation html
.PHONY: pdf
pdf: data
$(MAKE) -C documentation latexpdf
.PHONY: data
data:
$(MAKE) -C examples/doxygen all
$(MAKE) -C examples/tinyxml all
$(MAKE) -C examples/specific all
.PHONY: distclean
distclean: clean
$(MAKE) -C documentation clean
.PHONY: clean
clean:
$(MAKE) -C examples/doxygen $@
$(MAKE) -C examples/tinyxml $@
$(MAKE) -C examples/specific $@
.PHONY: test
test:
cd tests && pytest -v
.PHONY: dev-test
dev-test:
cd tests && PYTHONPATH=../:$(PYTHONPATH) pytest -v
.PHONY: flake8
flake8:
flake8 breathe/*.py \
breathe/directive/*.py \
@ -33,3 +42,7 @@ flake8:
breathe/renderer/sphinxrenderer.py \
breathe/renderer/filter.py \
breathe/parser/compound.py
.PHONY: type-check
type-check:
mypy breathe

2
breathe/renderer/sphinxrenderer.py

@ -5,7 +5,7 @@ from sphinx.domains import cpp, c, python
from sphinx.util.nodes import nested_parse_with_titles
try:
from sphinxcontrib import phpdomain as php
from sphinxcontrib import phpdomain as php # type: ignore
except ImportError:
php = None

14
mypy.ini

@ -0,0 +1,14 @@
[mypy]
[mypy-breathe.parser.compound]
ignore_errors = True
[mypy-breathe.parser.compoundsuper]
ignore_errors = True
[mypy-breathe.parser.index]
ignore_errors = True
[mypy-breathe.parser.indexsuper]
ignore_errors = True

1
requirements/development.txt

@ -2,3 +2,4 @@
pip-tools>=0.3.5
pytest
mypy

Loading…
Cancel
Save