diff --git a/dev.sh b/dev.sh index c63601b..407495a 100755 --- a/dev.sh +++ b/dev.sh @@ -5,7 +5,7 @@ docker build . -t docker-python-base case $1 in run) - docker run -p 8000:8000 docker-python-base + docker run -p 8000:8000 docker-python-base $2 ;; validate) @@ -19,4 +19,4 @@ case $1 in *) echo "Provide parameters 'run', 'validate', or 'cli' when calling e.g. ./dev.sh run" ;; -esac \ No newline at end of file +esac diff --git a/entrypoint.sh b/entrypoint.sh index d92d01f..15b07c1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -73,8 +73,14 @@ runtests() { } +interrogateverbose() { + echo "Verify docstring coverage" + interrogate -vv +} + + case "$1" in - startapp|developapp|validatecode|validatecodeonce|runtests) + startapp|developapp|validatecode|validatecodeonce|runtests|interrogateverbose) # Run the identified command and the provided arguments $@ ;; diff --git a/generate_requirements.sh b/generate_requirements.sh index 34ca4bb..2be8553 100755 --- a/generate_requirements.sh +++ b/generate_requirements.sh @@ -17,6 +17,7 @@ pip install \ flake8-quotes `# Plugin to enforce specific quotes convention, which PEP8 doesn't`\ flake8-print `# Plugin to prevent the use of print statements`\ black `# Formatting`\ + interrogate `# Checks code base for missing docstrings`\ pip freeze > requirements.txt diff --git a/requirements_3.10.txt b/requirements_3.10.txt index a1c75fa..e2872ab 100644 --- a/requirements_3.10.txt +++ b/requirements_3.10.txt @@ -4,6 +4,7 @@ asgiref==3.5.0 attrs==21.4.0 black==22.3.0 click==8.1.2 +colorama==0.4.4 coverage==6.3.2 fastapi==0.75.1 flake8==4.0.1 @@ -13,6 +14,7 @@ flake8-quotes==3.3.1 h11==0.13.0 idna==3.3 iniconfig==1.1.1 +interrogate==1.5.0 isort==5.10.1 loguru==0.6.0 mccabe==0.6.1 @@ -36,7 +38,9 @@ PyYAML==6.0 six==1.16.0 sniffio==1.2.0 starlette==0.17.1 +tabulate==0.8.9 testfixtures==6.18.5 +toml==0.10.2 tomli==2.0.1 typing_extensions==4.1.1 uvicorn==0.17.6 diff --git a/requirements_3.8.txt b/requirements_3.8.txt index a1c75fa..e2872ab 100644 --- a/requirements_3.8.txt +++ b/requirements_3.8.txt @@ -4,6 +4,7 @@ asgiref==3.5.0 attrs==21.4.0 black==22.3.0 click==8.1.2 +colorama==0.4.4 coverage==6.3.2 fastapi==0.75.1 flake8==4.0.1 @@ -13,6 +14,7 @@ flake8-quotes==3.3.1 h11==0.13.0 idna==3.3 iniconfig==1.1.1 +interrogate==1.5.0 isort==5.10.1 loguru==0.6.0 mccabe==0.6.1 @@ -36,7 +38,9 @@ PyYAML==6.0 six==1.16.0 sniffio==1.2.0 starlette==0.17.1 +tabulate==0.8.9 testfixtures==6.18.5 +toml==0.10.2 tomli==2.0.1 typing_extensions==4.1.1 uvicorn==0.17.6 diff --git a/requirements_3.9.txt b/requirements_3.9.txt index a1c75fa..e2872ab 100644 --- a/requirements_3.9.txt +++ b/requirements_3.9.txt @@ -4,6 +4,7 @@ asgiref==3.5.0 attrs==21.4.0 black==22.3.0 click==8.1.2 +colorama==0.4.4 coverage==6.3.2 fastapi==0.75.1 flake8==4.0.1 @@ -13,6 +14,7 @@ flake8-quotes==3.3.1 h11==0.13.0 idna==3.3 iniconfig==1.1.1 +interrogate==1.5.0 isort==5.10.1 loguru==0.6.0 mccabe==0.6.1 @@ -36,7 +38,9 @@ PyYAML==6.0 six==1.16.0 sniffio==1.2.0 starlette==0.17.1 +tabulate==0.8.9 testfixtures==6.18.5 +toml==0.10.2 tomli==2.0.1 typing_extensions==4.1.1 uvicorn==0.17.6 diff --git a/test_suite.sh b/test_suite.sh index a1956f0..662f46b 100755 --- a/test_suite.sh +++ b/test_suite.sh @@ -61,6 +61,10 @@ fi echo +echo -ne "$SECTION_PREFIX CHECK DOCSTRINGS: " +INTERROGATEOUT=`interrogate` +reportvalidation "$INTERROGATEOUT"; STATUS5=$? + if [[ $1 == "reports" ]] then echo -ne "$SECTION_PREFIX Report files created in $REPORTS_FOLDER\n" @@ -68,5 +72,5 @@ then echo fi -TOTAL=$((STATUS1 + STATUS2 + STATUS3 + STATUS4 + STATUS5)) +TOTAL=$((STATUS1 + STATUS2 + STATUS3 + STATUS4 + STATUS5 + STATUS6)) exit $TOTAL diff --git a/tests/pyproject.toml b/tests/pyproject.toml new file mode 100644 index 0000000..9f61a50 --- /dev/null +++ b/tests/pyproject.toml @@ -0,0 +1,12 @@ +[tool.interrogate] +ignore-init-method = true +ignore-init-module = true +ignore-magic = true +ignore-semiprivate = true +ignore-private = true +ignore-property-decorators = true +ignore-module = true +ignore-nested-functions = true +ignore-nested-classes = true +ignore-setters = true +fail-under = 95 diff --git a/tests/webapp/main.py b/tests/webapp/main.py index 678aff5..eb2d891 100644 --- a/tests/webapp/main.py +++ b/tests/webapp/main.py @@ -5,4 +5,5 @@ @app.get('/') async def root(): + """A simple Hello World endpoint""" return {'message': 'Hello World'} diff --git a/tests/webapp/tests/simple_test.py b/tests/webapp/tests/simple_test.py index 9da8a08..3692a91 100644 --- a/tests/webapp/tests/simple_test.py +++ b/tests/webapp/tests/simple_test.py @@ -1,2 +1,3 @@ def test_something(): + """Just a test to have something for pytest to chew on""" assert True