File .deepsource.toml
not found in the default branch of the repository root. Please refer to the docs.
else
/elif
used after raise
PYL-R1720 848 if data.get("plan_components"):
849 component_metrics = []
850 for component in data.get("plan_components"):
851 if component.get("billable_metric") in component_metrics: 852 raise serializers.ValidationError(
853 "Plan components must have unique metrics."
854 )
raise
causes control flow to be disrupted, as it will exit the block.
It is recommended to check other conditions using another if
statement, and get rid of else
statements as they are unnecessary.
def check_magic_generator(attribute):
magic = get_magic_number(attribute)
if magic < 0:
raise ValueError(f"{attribute} looks invalid")
elif magic > 100
raise ValueError(f"{attribute} is very magical")
else:
return magic
def check_magic_generator(attribute):
magic = get_magic_number(attribute)
if magic < 0:
raise ValueError(f"{attribute} looks invalid")
if magic > 100
raise ValueError(f"{attribute} is very magical")
return magic