You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to replace prospector with flake8 with plugins. Prospector is not as widely used as flake8 .
@sverhoeven Looking at that link, I don't think flake8 includes support for pylint, which to my knowledge, is by the best open-source linting tool for Python available. We also recommend using it in the guide: https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=coding-style-conventions. I noticed that support for sonar linting services was added to this repository. That could be an alternative to pylint, but does sonar use open-source linting tools to run its service? For consistent results, I would recommend having the same linter locally as in the linter service that is integrated with GitHub.
Putting linting in pytest is not the direction I would like to go in as it combines testing and linting which are I feel different tasks.
I agree. It is possible to run flake8 as a unit test (via pytest-flake8), to enforce a style and maybe catch some of the most obvious mistakes, or you could also run the automatic formatter and make the test fail if it reports changes, but that's as far as I would go. Running a tool like pylint as a unit test is not a good idea because it will report false positives: it tries to guide you in making nice code, but it cannot know everything.
Activity
bouweandela commentedon Apr 19, 2021
flake8 has a different purpose than prospector. From it's documentation:
while prospector is
so I'm not convinced that replacing it with just flake8 is the right thing to do.
sverhoeven commentedon Apr 20, 2021
Looking at https://towardsdatascience.com/static-code-analysis-for-python-bdce10b8d287 flake8 plugins could cover prospectors features.
fdiblen commentedon Apr 20, 2021
For the 0.3.0 release we will keep prospector and use githooks as described in https://github.com/fair-software/howfairis/blob/main/README.dev.rst.
Ref: #82
sverhoeven commentedon Apr 20, 2021
I would like to replace prospector with flake8 with plugins. Prospector is not as widely used as flake8 .
Putting linting in pytest is not the direction I would like to go in as it combines testing and linting which are I feel different tasks.
sverhoeven commentedon May 7, 2021
Also propspector pins isort to a very old version (v3).
bouweandela commentedon May 17, 2021
@sverhoeven Looking at that link, I don't think flake8 includes support for pylint, which to my knowledge, is by the best open-source linting tool for Python available. We also recommend using it in the guide: https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=coding-style-conventions. I noticed that support for sonar linting services was added to this repository. That could be an alternative to pylint, but does sonar use open-source linting tools to run its service? For consistent results, I would recommend having the same linter locally as in the linter service that is integrated with GitHub.
I agree. It is possible to run flake8 as a unit test (via pytest-flake8), to enforce a style and maybe catch some of the most obvious mistakes, or you could also run the automatic formatter and make the test fail if it reports changes, but that's as far as I would go. Running a tool like pylint as a unit test is not a good idea because it will report false positives: it tries to guide you in making nice code, but it cannot know everything.
bouweandela commentedon May 17, 2021
Sorry, accidentally clicked the close button.
sverhoeven commentedon Aug 12, 2021
Another option could be wemake-python-styleguide.
It's a shame that it is not compatible with formatters like yapf or black
egpbos commentedon Dec 22, 2023
This discussion has been followed up and resolved in #336 and #347.