Skip to content

Replace prospector with pytest-flake8 #181

Closed

Description

@fdiblen

Use flake8 to lint the generated package (https://pypi.org/project/pytest-flake8).

Activity

  1. added
    generated-packageRelated to the generated package, i.e. after running cookiecutter
    on Apr 19, 2021
  2. added this to the 0.3.0 milestone on Apr 19, 2021
  3. bouweandela commented on Apr 19, 2021

    @bouweandela
    Member

    flake8 has a different purpose than prospector. From it's documentation:

    Flake8: Your Tool For Style Guide Enforcement

    while prospector is

    Prospector is a tool to analyse Python code and output information about errors, potential problems, convention violations and complexity.

    so I'm not convinced that replacing it with just flake8 is the right thing to do.

  4. sverhoeven commented on Apr 20, 2021

    @sverhoeven
    Member

    Looking at https://towardsdatascience.com/static-code-analysis-for-python-bdce10b8d287 flake8 plugins could cover prospectors features.

  5. fdiblen commented on Apr 20, 2021

    @fdiblen
    MemberAuthor

    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

  6. modified the milestones: 0.3.0, on Apr 20, 2021
  7. sverhoeven commented on Apr 20, 2021

    @sverhoeven
    Member

    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.

  8. removed this from the milestone on Apr 28, 2021
  9. sverhoeven commented on May 7, 2021

    @sverhoeven
    Member

    Also propspector pins isort to a very old version (v3).

  10. bouweandela commented on May 17, 2021

    @bouweandela
    Member

    Looking at https://towardsdatascience.com/static-code-analysis-for-python-bdce10b8d287 flake8 plugins could cover prospectors features.

    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.

  11. bouweandela commented on May 17, 2021

    @bouweandela
    Member

    Sorry, accidentally clicked the close button.

  12. sverhoeven commented on Aug 12, 2021

    @sverhoeven
    Member

    Another option could be wemake-python-styleguide.
    It's a shame that it is not compatible with formatters like yapf or black

  13. egpbos commented on Dec 22, 2023

    @egpbos
    Collaborator

    This discussion has been followed up and resolved in #336 and #347.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    generated-packageRelated to the generated package, i.e. after running cookiecutter

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions