jdkandersson / flake8-docstrings-complete

Apache License 2.0
12 stars 2 forks source link

avoid raising DCO010 for overloads #21

Closed vpoulailleau closed 10 months ago

vpoulailleau commented 10 months ago

closes #20

jdkandersson commented 10 months ago

Thanks for submitting this, it looks like there are some code coverage issues. Once resolved please I'm happy to merge this

vpoulailleau commented 10 months ago

@jdkandersson This is strange: the line 326 in flake8_docstrings_complete/__init__.py is said not being covered. Though this is the line that calls the detection of @overload. If I replace the not covered return True by a not covered return False, then the two tests that I added are failing… And the line is still marked as not covered…

vpoulailleau commented 10 months ago

I start to see the point. pytest-cov and coverage don't report the same thing! I'm used to pytest-cov (100% coverage and branch coverage) whereas coverage reports missing branch coverage… (being more precise on condition combinations.

vpoulailleau commented 10 months ago

@jdkandersson This is very strange…

When I run

python -m pytest -v --tb native -s --cov=flake8_docstrings_complete --cov=tests --cov-branch
python -m coverage report

I get:

Name                                      Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------------------------
flake8_docstrings_complete/__init__.py      157      0     56      0   100%
flake8_docstrings_complete/args.py           46      0     30      0   100%
flake8_docstrings_complete/attrs.py         120      0     65      0   100%
flake8_docstrings_complete/constants.py       2      0      0      0   100%
flake8_docstrings_complete/docstring.py      45      0     12      0   100%
flake8_docstrings_complete/raises.py         51      0     36      0   100%
flake8_docstrings_complete/types_.py         15      0      0      0   100%
tests/__init__.py                             0      0      0      0   100%
tests/integration/__init__.py                 0      0      0      0   100%
tests/integration/test___init__.py           51      0     12      0   100%
tests/test_docstring.py                      13      0      4      0   100%
tests/unit/__init__.py                        0      0      0      0   100%
tests/unit/result.py                          7      0      2      0   100%
tests/unit/test___init__.py                  10      0      4      0   100%
tests/unit/test___init__args.py               7      0      2      0   100%
tests/unit/test___init__attrs.py              8      0      2      0   100%
tests/unit/test___init__raises.py             7      0      2      0   100%
-------------------------------------------------------------------------------------
TOTAL                                       539      0    227      0   100%

But when I run:

python -m coverage run -m pytest -v --tb native -s  # or with an extra --cov-branch
python -m coverage report

I get:

Name                                      Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------------------------
flake8_docstrings_complete/__init__.py      157      1     56      1    99%   326
flake8_docstrings_complete/args.py           46      0     30      0   100%
flake8_docstrings_complete/attrs.py         120      3     65      1    98%   90-92
flake8_docstrings_complete/constants.py       2      0      0      0   100%
flake8_docstrings_complete/docstring.py      45      0     12      0   100%
flake8_docstrings_complete/raises.py         51      0     36      0   100%
flake8_docstrings_complete/types_.py         15      0      0      0   100%
tests/__init__.py                             0      0      0      0   100%
tests/integration/__init__.py                 0      0      0      0   100%
tests/integration/test___init__.py           51      0     12      0   100%
tests/test_docstring.py                      13      0      4      0   100%
tests/unit/__init__.py                        0      0      0      0   100%
tests/unit/result.py                          7      0      2      0   100%
tests/unit/test___init__.py                  10      0      4      0   100%
tests/unit/test___init__args.py               7      0      2      0   100%
tests/unit/test___init__attrs.py              8      0      2      0   100%
tests/unit/test___init__raises.py             7      0      2      0   100%
-------------------------------------------------------------------------------------
TOTAL                                       539      4    227      2    99%
Coverage failure: total of 99 is less than fail-under=100

Any idea why the branch coverage report is different with the same test suite?

jdkandersson commented 10 months ago

I created a PR for this, please confirm that it addresses the feature request: https://github.com/jdkandersson/flake8-docstrings-complete/pull/22

I realised that a few pieces of logic were in the wrong place. Not sure what is going on with the coverage checking. I recommend using the tox -e test-flake86 command which will run the tests in the same way as in CI.

vpoulailleau commented 10 months ago

Superseded by #22