python-for-android icon indicating copy to clipboard operation
python-for-android copied to clipboard

Prerequisite.is_valid has unexpected return values.

Open Julian-O opened this issue 2 years ago • 0 comments

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.]

Julian-O avatar Jul 23 '23 06:07 Julian-O