Refactor the format_validate_parameter fuction to reduce complexity
Adding a if condition to format_validate_parameter function, is failing the pep validation, because of complexity is going beyond the 20 limit. Separating the constraints from the base makes it, simpler. Change-Id: Iaa4cdfceea67a17af1e17512cc28eb54dd52907d
This commit is contained in:
parent
7f57074e98
commit
554add6004
|
@ -524,6 +524,12 @@ def format_validate_parameter(param):
|
|||
if param.user_value:
|
||||
res[rpc_api.PARAM_VALUE] = param.user_value
|
||||
|
||||
_build_parameter_constraints(res, param)
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def _build_parameter_constraints(res, param):
|
||||
constraint_description = []
|
||||
|
||||
# build constraints
|
||||
|
@ -565,8 +571,6 @@ def format_validate_parameter(param):
|
|||
res[rpc_api.PARAM_CONSTRAINT_DESCRIPTION] = " ".join(
|
||||
constraint_description)
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def format_software_config(sc, detail=True, include_project=False):
|
||||
if sc is None:
|
||||
|
|
Loading…
Reference in New Issue