has - arnthor89/pygame GitHub Wiki
Description
The has function is a part of the Sprite class, and it's responsible of determining whether or not a group contains a sprite/several sprites. This is done by using isinstance(object, class), where the group is the class and the object is the sprite/sprites to be checked.
Complexity
The cyclomatic complexity of this function is 10, and nloc is 52.
Refactoring Strategy
A possible refactor to lower the complexity is to split the has functions in two new has-functions:
- One that matches if a single sprite is to be checked for group membership.
- One that matches if a sequence of sprites is to be checked. When one sprite is sorted out of this sequence, has function for single sprites may be called.