add sonar exclusions for stuff that is not our code and refactor complex function
This commit is contained in:
parent
db7764d6c9
commit
4c6af8eac1
|
@ -4,5 +4,6 @@ sonar.host.url=https://sonarcloud.io
|
||||||
sonar.python.version=3.8,3.9,3.10
|
sonar.python.version=3.8,3.9,3.10
|
||||||
sonar.python.coverage.reportPaths=coverage.xml
|
sonar.python.coverage.reportPaths=coverage.xml
|
||||||
sonar.test.inclusions=tests
|
sonar.test.inclusions=tests
|
||||||
|
sonar.exclusions=migrations/**,bin/keycloak_test_server.py
|
||||||
# sonar.exclusions=crc/templates/*.html,docs/**,config/**,instance/**,migrations/**,postgres/**,readme_images/**,schema/**,templates/**
|
# sonar.exclusions=crc/templates/*.html,docs/**,config/**,instance/**,migrations/**,postgres/**,readme_images/**,schema/**,templates/**
|
||||||
# sonar.sources=crc
|
# sonar.sources=crc
|
||||||
|
|
|
@ -68,15 +68,11 @@ def format_task(task: Task, include_state: bool = True) -> str:
|
||||||
return f"{lane} {task.task_spec.description} ({task.task_spec.name}) {state}"
|
return f"{lane} {task.task_spec.description} ({task.task_spec.name}) {state}"
|
||||||
|
|
||||||
|
|
||||||
def complete_user_task(
|
def process_field(
|
||||||
task: Task, answer: Optional[Dict[str, str]] = None
|
field: Any, answer: Union[dict, None], required_user_input_fields: Dict[str, str]
|
||||||
) -> Dict[Any, Any]:
|
) -> Union[str, None]:
|
||||||
"""Complete_user_task."""
|
"""Handles the complexities of figuring out what to do about each necessary user field."""
|
||||||
required_user_input_fields = {}
|
response = None
|
||||||
if task.data is None:
|
|
||||||
task.data = {}
|
|
||||||
|
|
||||||
for field in task.task_spec.form.fields:
|
|
||||||
if isinstance(field, EnumFormField):
|
if isinstance(field, EnumFormField):
|
||||||
option_map = {opt.name: opt.id for opt in field.options}
|
option_map = {opt.name: opt.id for opt in field.options}
|
||||||
options = "(" + ", ".join(option_map) + ")"
|
options = "(" + ", ".join(option_map) + ")"
|
||||||
|
@ -95,6 +91,20 @@ def complete_user_task(
|
||||||
else:
|
else:
|
||||||
if field.type == "long":
|
if field.type == "long":
|
||||||
response = int(answer[field.label])
|
response = int(answer[field.label])
|
||||||
|
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def complete_user_task(
|
||||||
|
task: Task, answer: Optional[Dict[str, str]] = None
|
||||||
|
) -> Dict[Any, Any]:
|
||||||
|
"""Complete_user_task."""
|
||||||
|
if task.data is None:
|
||||||
|
task.data = {}
|
||||||
|
|
||||||
|
required_user_input_fields: Dict[str, str] = {}
|
||||||
|
for field in task.task_spec.form.fields:
|
||||||
|
response = process_field(field, answer, required_user_input_fields)
|
||||||
if answer:
|
if answer:
|
||||||
task.update_data_var(field.id, response)
|
task.update_data_var(field.id, response)
|
||||||
return required_user_input_fields
|
return required_user_input_fields
|
||||||
|
|
Loading…
Reference in New Issue