Python pydoctyle with prospector gives false positives

Using Codacy on my repository, I’m using pydocstyle to validate my documentation.

pipenv run pydocstyle rethinkmodel/ -v
Checking file rethinkmodel/__init__.py.
Checking file rethinkmodel/db.py.
Checking file rethinkmodel/manage.py.
Checking file rethinkmodel/model.py.
Checking file rethinkmodel/tests/__init__.py.
Checking file rethinkmodel/tests/utils.py.

I’ve got absolutely no error, no warnings, everything is correct.

In Codacy, I’ve got 41 errors on Python, given by “Prospector”.

What is wrong ?

Hi,
Prospector is another static analysis tool. See:
http://prospector.landscape.io/en/master/#:~:text=Prospector%20is%20a%20tool%20to,%2C%20pep8%2C%20and%20McCabe%20complexity

Codacy has lots of builtin tools as you can see on the “Code patterns” tab. Do you have Prospector enabled here? Presumably Prospector checks different things to pydocstyle, hence the errors

2 Likes

Actually, prospector uses an old pylint version (2.5.3) and has a lot of problems with typing package (Optional and Union are reported as unsubscriptable)

The problem is that prospector doesn’t report any problem on my machine about documentation.

pipenv run prospector rethinkmodel/
Messages
========

rethinkmodel/model.py
  Line: 248
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 26)
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 44)
  Line: 272
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 15)
  Line: 273
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 16)
  Line: 274
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 18)
    pylint: unsubscriptable-object / Value 'Union' is unsubscriptable (col 27)
  Line: 323
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 16)
    pylint: unsubscriptable-object / Value 'Union' is unsubscriptable (col 25)
  Line: 324
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 15)
  Line: 325
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 16)
  Line: 326
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 18)
    pylint: unsubscriptable-object / Value 'Union' is unsubscriptable (col 27)
  Line: 327
    pylint: unsubscriptable-object / Value 'Union' is unsubscriptable (col 9)
  Line: 364
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 15)
  Line: 365
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 16)
  Line: 366
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 18)
    pylint: unsubscriptable-object / Value 'Union' is unsubscriptable (col 27)
  Line: 408
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 15)
  Line: 409
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 16)
  Line: 410
    pylint: unsubscriptable-object / Value 'Optional' is unsubscriptable (col 18)
    pylint: unsubscriptable-object / Value 'Union' is unsubscriptable (col 27)



Check Information
=================
         Started: 2021-03-04 15:02:54.452695
        Finished: 2021-03-04 15:02:56.860592
      Time Taken: 2.41 seconds
       Formatter: grouped
        Profiles: default, no_doc_warnings, no_test_warnings, strictness_medium, strictness_high, strictness_veryhigh, no_member_warnings
      Strictness: None
  Libraries Used: 
       Tools Run: dodgy, mccabe, pep8, profile-validator, pyflakes, pylint
  Messages Found: 21

So, I don’t know what’s wrong on Codacy - I’m using the same version (1.3.1) locally to check, and everything is OK.

I must remove prospector to have correct PyLint version now…

Oh… on my computer it doesn’t launch pydocstyle from prospector. On Codacy that’s what it does.

So, if I’m not wrong, there is no way to use pydocstyle with a correct version on Codacy because it’s prospector wich is used with very old versions :frowning:

Sorry, I meant “pydocstyle” and not “pycodestyle”.

The problems comes from prospector wich uses “pydocstyle” in a very old version it seems, as for pylint.

So, I will deactivate (if it works…) pydocstyle check from prospector in Codacy.

Nothing to do…
I deactivated pep257 and pydocstyle from prospector and I still have issues:

And that’s the same problem for others options or checker that I uncheck. They still gives errors even if deactivated.

I think that I will, unfortunatly, go back to SonarCloud :frowning: (where coverage is not well managed, but I will not have more and more errors while the documentation grows)

I presume you have pushed something after deactivating the options? I don’t think changing the options triggers a new review process so that may be why you don’t see the difference.

In my code I usually prefer using configuration files for more control. Then you can turn on the errors that interest you rather than having to find each one individually to deactivate it when an error is raised

1 Like

Yes, of course :slight_smile:

I did it right now. The errors are still here. I also send the problem about another tool that I deactivated (for markdown) which still gives errors.

Actually, whatever the checker I deactivate, they continue to report errors.

That’s strange I have never had that problem. Other than making sure you push I don’t have any ideas or recommendations. It’s true that it’s a bit strange that the code needs reviewing again in order for the old checks to disappear. You would expect them to go as soon as they are deactivated, presumably Codacy wanted the same behaviour for activating and deactivating

1 Like

Hello @metal3d, can you share the URL of your repository on Codacy so that we can check?

Hi,

I’m sorry, I finally go back to SonarCloud. I hope you’ll find the problem and the solution for others users.

Hi @metal3d, we’re sorry to know about this, and we’re investigating the issue.

Also, thank you @EmilyBourne for helping out!

1 Like

‫في الجمعة، 5 مارس 2021 في 12:58 م تمت كتابة ما يلي بواسطة ‪Paulo Ribeiro via Codacy Community‬‏ <‪codacycommunity@discoursemail.com‬‏>:‬

Hello @Hamo_Mohamed, and welcome to the Codacy Community! :wave: Unfortunately, your message did not seem to come through.

1 Like