Skip to content

Commit 004d9a9

Browse files
committed
[NRL-1922] Resolve all remaining low sev Sonar warnings
1 parent 524d91a commit 004d9a9

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

layer/nrlf/core/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class PointerTypes(Enum):
7373

7474
@staticmethod
7575
def list():
76-
return list(map(lambda type: type.value, PointerTypes))
76+
return [type.value for type in PointerTypes]
7777

7878
def coding_system(self):
7979
return self.value.split(TYPE_SEPARATOR)[0]
@@ -93,7 +93,7 @@ class Categories(Enum):
9393

9494
@staticmethod
9595
def list():
96-
return list(map(lambda category: category.value, Categories))
96+
return [category.value for category in Categories]
9797

9898
def coding_system(self):
9999
return self.value.split(TYPE_SEPARATOR)[0]

layer/nrlf/core/validators.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def validate(self, data: Dict[str, Any] | DocumentReference):
146146
self._validate_content(resource)
147147
self._validate_content_format(resource)
148148
self._validate_content_extension(resource)
149-
self._validate_practiceSetting(resource)
149+
self._validate_practice_setting(resource)
150150

151151
except StopValidationError:
152152
logger.log(LogReference.VALIDATOR003)
@@ -287,19 +287,16 @@ def _validate_asid(self, asid_references: list):
287287
diagnostics=f"Invalid ASID value '{asid_value}'. A single ASID consisting of 12 digits can be provided in the context.related field.",
288288
field=f"context.related[{idx}].identifier.value",
289289
)
290-
return
291290

292291
def _validate_ssp_asid(self, model: DocumentReference):
293292
"""
294293
Validate that the document contains a valid ASID in the context.related field when the content contains an SSP URL
295294
"""
296295

297296
ssp_content = any(
298-
[
299-
content
300-
for content in model.content
301-
if content.attachment.url.startswith("ssp://")
302-
]
297+
content
298+
for content in model.content
299+
if content.attachment.url.startswith("ssp://")
303300
)
304301

305302
logger.log(LogReference.VALIDATOR001, step="ssp_content_and_asid_exists")
@@ -338,7 +335,6 @@ def _validate_ssp_asid(self, model: DocumentReference):
338335
diagnostics="Missing ASID identifier. context.related must contain a single valid ASID identifier when content contains an SSP URL",
339336
field="context.related",
340337
)
341-
return
342338

343339
def _validate_type(self, model: DocumentReference):
344340
"""
@@ -652,9 +648,8 @@ def _validate_author(self, model: DocumentReference):
652648
diagnostics=f"Invalid author value: '{identifier.value}' Author value must be less than 13 characters",
653649
field="author[0].identifier.value",
654650
)
655-
return
656651

657-
def _validate_practiceSetting(self, model: DocumentReference):
652+
def _validate_practice_setting(self, model: DocumentReference):
658653
"""
659654
Validate the practice setting field contains an appropriate coding system and code.
660655
"""
@@ -716,7 +711,6 @@ def _validate_practiceSetting(self, model: DocumentReference):
716711
diagnostics=f"Invalid practice setting coding: display {practice_setting_display} does not match the expected display for {practice_setting_value} Practice Setting coding is bound to value set {PRACTICE_SETTING_VALUE_SET_URL}",
717712
field="context.practiceSetting.coding[0]",
718713
)
719-
return
720714

721715
def _validate_content(self, model: DocumentReference):
722716
"""

terraform/account-wide-infrastructure/modules/glue/LogSchemaGeneration/LogSchemaGeneration.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
")\n",
1313
"import json\n",
1414
"from datetime import datetime, timedelta\n",
15-
"from typing import List, Dict, Type, Set, Any"
15+
"from typing import List, Dict, Any"
1616
]
1717
},
1818
{
@@ -22,7 +22,7 @@
2222
"outputs": [],
2323
"source": [
2424
"# Initialize CloudWatch client\n",
25-
"session = boto3.Session(region_name=\"eu-west-2\", profile_name=\"nhsd-nrlf-dev\")\n",
25+
"session = boto3.Session(profile_name=\"nhsd-nrlf-dev\")\n",
2626
"client = session.client(\"logs\")"
2727
]
2828
},

0 commit comments

Comments
 (0)