Skip to content

Prerequisite.is_valid has unexpected return values. #2865

Open

Description

@Julian-O

Description

The class Prerequisite has an is_valid() method.

If the prerequisite passes the check, it returns (True, "").
There is no mention what the tuple means, and the only caller (check_and_install_default_prerequisites) just cares about its truthiness, anyway. It should just return True.

If the prerequisite fails the check, and is mandatory, an error is logged... and the function falls out without returning a value. It should explicitly return False for clarity, rather than implicitly returning None.

If the prerequisite fails the check, but is not mandatory, a warning is logged... and again the function falls out without returning a value. Given the context (anything returning False is attempted to be installed), I believe this should return True

[This is low priority for me; I am not sure if a PR will follow later, so I am recording it as an issue.]

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions