manoelhc / test-actions

Unnecessary else/elif used after raise PYL-R1720
Style
Minor
3 occurrences in this check
Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it
 51                )
 52
 53            if user_auth:
 54                if auth.new_password != auth.new_password_confirm: 55                    raise HTTPException(
 56                        status_code=400,
 57                        detail="Passwords don't match.",
Unnecessary "elif" after "raise", remove the leading "el" from "elif"
 8        raise ValueError("Username should be more than 2 characters")
 9    elif len(username) >= 255:
10        raise ValueError("Username should be less than 255 characters")
11    if re.match(r"^[a-z0-9.-_]+$", username) is None:12        raise ValueError("Username must be alphanumeric, underscore and dots only")
13    elif username.find("[deleted]") > 0:
14        raise ValueError("Username must be alphanumeric, underscore and dots only")
Unnecessary "elif" after "raise", remove the leading "el" from "elif"
 4
 5def validate_user(username: str) -> str:
 6    # TODO: https://github.com/shouldbee/reserved-usernames/blob/master/reserved-usernames.txt
 7    if len(username) <= 2: 8        raise ValueError("Username should be more than 2 characters")
 9    elif len(username) >= 255:
10        raise ValueError("Username should be less than 255 characters")