kivy / kivy/python-for-android

Prerequisite.is_valid has unexpected return values.

Open
#2,865 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
8.9k
Forks
2k
Avg merge
12h 20m
Merged PRs (30d)
9

Description

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

Contributor guide

Open the contributing guide

Research direction

Search for the Prerequisite class and its is_valid() method, then inspect the sole caller, check_and_install_default_prerequisites. Trace each mandatory and optional failure path and verify that the method's return values match the caller's truthiness-based behavior. Done means all paths return explicit boolean values consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.