Skip to content

Commit 2c09acb

Browse files
authored
✅ Add interrogate (#326)
* Add interrogate package * Add ability to run any command for testing * Add interrogate test and verbose command * Adjust the test app to have interrogate results
1 parent ab8c426 commit 2c09acb

File tree

10 files changed

+41
-4
lines changed

10 files changed

+41
-4
lines changed

dev.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ docker build . -t docker-python-base
55

66
case $1 in
77
run)
8-
docker run -p 8000:8000 docker-python-base
8+
docker run -p 8000:8000 docker-python-base $2
99
;;
1010

1111
validate)
@@ -19,4 +19,4 @@ case $1 in
1919
*)
2020
echo "Provide parameters 'run', 'validate', or 'cli' when calling e.g. ./dev.sh run"
2121
;;
22-
esac
22+
esac

entrypoint.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,14 @@ runtests() {
7373
}
7474

7575

76+
interrogateverbose() {
77+
echo "Verify docstring coverage"
78+
interrogate -vv
79+
}
80+
81+
7682
case "$1" in
77-
startapp|developapp|validatecode|validatecodeonce|runtests)
83+
startapp|developapp|validatecode|validatecodeonce|runtests|interrogateverbose)
7884
# Run the identified command and the provided arguments
7985
$@
8086
;;

generate_requirements.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pip install \
1717
flake8-quotes `# Plugin to enforce specific quotes convention, which PEP8 doesn't`\
1818
flake8-print `# Plugin to prevent the use of print statements`\
1919
black `# Formatting`\
20+
interrogate `# Checks code base for missing docstrings`\
2021

2122

2223
pip freeze > requirements.txt

requirements_3.10.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ asgiref==3.5.0
44
attrs==21.4.0
55
black==22.3.0
66
click==8.1.2
7+
colorama==0.4.4
78
coverage==6.3.2
89
fastapi==0.75.1
910
flake8==4.0.1
@@ -13,6 +14,7 @@ flake8-quotes==3.3.1
1314
h11==0.13.0
1415
idna==3.3
1516
iniconfig==1.1.1
17+
interrogate==1.5.0
1618
isort==5.10.1
1719
loguru==0.6.0
1820
mccabe==0.6.1
@@ -36,7 +38,9 @@ PyYAML==6.0
3638
six==1.16.0
3739
sniffio==1.2.0
3840
starlette==0.17.1
41+
tabulate==0.8.9
3942
testfixtures==6.18.5
43+
toml==0.10.2
4044
tomli==2.0.1
4145
typing_extensions==4.1.1
4246
uvicorn==0.17.6

requirements_3.8.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ asgiref==3.5.0
44
attrs==21.4.0
55
black==22.3.0
66
click==8.1.2
7+
colorama==0.4.4
78
coverage==6.3.2
89
fastapi==0.75.1
910
flake8==4.0.1
@@ -13,6 +14,7 @@ flake8-quotes==3.3.1
1314
h11==0.13.0
1415
idna==3.3
1516
iniconfig==1.1.1
17+
interrogate==1.5.0
1618
isort==5.10.1
1719
loguru==0.6.0
1820
mccabe==0.6.1
@@ -36,7 +38,9 @@ PyYAML==6.0
3638
six==1.16.0
3739
sniffio==1.2.0
3840
starlette==0.17.1
41+
tabulate==0.8.9
3942
testfixtures==6.18.5
43+
toml==0.10.2
4044
tomli==2.0.1
4145
typing_extensions==4.1.1
4246
uvicorn==0.17.6

requirements_3.9.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ asgiref==3.5.0
44
attrs==21.4.0
55
black==22.3.0
66
click==8.1.2
7+
colorama==0.4.4
78
coverage==6.3.2
89
fastapi==0.75.1
910
flake8==4.0.1
@@ -13,6 +14,7 @@ flake8-quotes==3.3.1
1314
h11==0.13.0
1415
idna==3.3
1516
iniconfig==1.1.1
17+
interrogate==1.5.0
1618
isort==5.10.1
1719
loguru==0.6.0
1820
mccabe==0.6.1
@@ -36,7 +38,9 @@ PyYAML==6.0
3638
six==1.16.0
3739
sniffio==1.2.0
3840
starlette==0.17.1
41+
tabulate==0.8.9
3942
testfixtures==6.18.5
43+
toml==0.10.2
4044
tomli==2.0.1
4145
typing_extensions==4.1.1
4246
uvicorn==0.17.6

test_suite.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ fi
6161

6262
echo
6363

64+
echo -ne "$SECTION_PREFIX CHECK DOCSTRINGS: "
65+
INTERROGATEOUT=`interrogate`
66+
reportvalidation "$INTERROGATEOUT"; STATUS5=$?
67+
6468
if [[ $1 == "reports" ]]
6569
then
6670
echo -ne "$SECTION_PREFIX Report files created in $REPORTS_FOLDER\n"
6771
ls $REPORTS_FOLDER
6872
echo
6973
fi
7074

71-
TOTAL=$((STATUS1 + STATUS2 + STATUS3 + STATUS4 + STATUS5))
75+
TOTAL=$((STATUS1 + STATUS2 + STATUS3 + STATUS4 + STATUS5 + STATUS6))
7276
exit $TOTAL

tests/pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[tool.interrogate]
2+
ignore-init-method = true
3+
ignore-init-module = true
4+
ignore-magic = true
5+
ignore-semiprivate = true
6+
ignore-private = true
7+
ignore-property-decorators = true
8+
ignore-module = true
9+
ignore-nested-functions = true
10+
ignore-nested-classes = true
11+
ignore-setters = true
12+
fail-under = 95

tests/webapp/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55

66
@app.get('/')
77
async def root():
8+
"""A simple Hello World endpoint"""
89
return {'message': 'Hello World'}

tests/webapp/tests/simple_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
def test_something():
2+
"""Just a test to have something for pytest to chew on"""
23
assert True

0 commit comments

Comments
 (0)