Katolus / functions

Unnecessary else / elif used after return PYL-R1705
Style
Major
2 years ago3 years old
Unnecessary "else" after "return"
13    """Deploys the function to GCP"""
14    service = function.config.deploy_variables.service
15
16    if service == GCPServices.CLOUD_FUNCTION:17        from .cloud_function.cli import deploy_function
18
19        return deploy_function(function)
Unnecessary "else" after "return"
24def describe(function: FunctionRecord) -> None:
25    """Use the `describe` command to retrieve information about a function"""
26    service = function.config.deploy_variables.service
27    if service == GCPServices.CLOUD_FUNCTION:28        from .cloud_function.cli import run_describe_cmd
29
30        return run_describe_cmd(function)
Unnecessary "else" after "return"
35def fetch_logs(function: FunctionRecord) -> None:
36    """Fetches the logs for the function"""
37    service = function.config.deploy_variables.service
38    if service == GCPServices.CLOUD_FUNCTION:39        from .cloud_function.cli import fetch_function_logs
40
41        return fetch_function_logs(function)
Unnecessary "else" after "return"
 32    trigger_type: TriggerType, trigger_value: Optional[str] = None
 33) -> List[str]:
 34    """Returns a list of arguments to append that denote the type of trigger applied"""
 35    if trigger_value: 36        return [trigger_type, trigger_value]
 37    else:
 38        return [trigger_type]
Unnecessary "else" after "return"
11) -> str:
12    """Validates the GCP deploy command"""
13    # Check if the function name is in the function registry
14    if FunctionRegistry.check_if_function_name_in_registry(function_name):15        return function_name
16    else:
17        raise typer.BadParameter(