Skip to content

Commit 4899d08

Browse files
authored
VED-879: Fix Sonar issue ignore filters (#1223)
* corrected issue.ignore filters * S7494 * S7494 II * kick * kick * kick
1 parent 5fb67ae commit 4899d08

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

lambdas/backend/src/search_imms_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def search_imms(event: APIGatewayProxyEventV1, controller: FhirController):
3030
)
3131
parser.add_argument(
3232
"--immunization.target",
33-
help="http://hl7.org/fhir/ValueSet/immunization-target-disease", # NOSONAR(S5332)
33+
help="http://hl7.org/fhir/ValueSet/immunization-target-disease",
3434
type=str,
3535
required=True,
3636
nargs="+",

lambdas/delta_backend/src/extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Extractor:
1414
)
1515
EXTENSION_URL_SCT_DESC_DISPLAY = "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescDisplay"
1616

17-
CODING_SYSTEM_URL_SNOMED = "http://snomed.info/sct" # NOSONAR(S5332) this is a code system descriptor, not a URL
17+
CODING_SYSTEM_URL_SNOMED = "http://snomed.info/sct"
1818
ODS_ORG_CODE_SYSTEM_URL = "https://fhir.nhs.uk/Id/ods-organization-code"
1919
DEFAULT_LOCATION = "X99999"
2020
NHS_NUMBER_SYSTEM_URL = "https://fhir.nhs.uk/Id/nhs-number"

lambdas/id_sync/src/pds_details.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from os_vars import get_pds_env
1313

1414
pds_env = get_pds_env()
15-
safe_tmp_dir = tempfile.mkdtemp(dir="/tmp") # NOSONAR(S5443)
15+
safe_tmp_dir = tempfile.mkdtemp(dir="/tmp")
1616

1717

1818
# Get Patient details from external service PDS using NHS number from MNS notification

lambdas/mesh_processor/src/converter.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111

1212

1313
def parse_headers(headers_str: str) -> dict[str, str]:
14-
headers = dict( # NOSONAR(S7494) force this to dict
15-
header_str.split(":", 1) for header_str in headers_str.split("\r\n") if ":" in header_str
16-
)
14+
headers = dict(header_str.split(":", 1) for header_str in headers_str.split("\r\n") if ":" in header_str)
1715
return {k.strip(): v.strip() for k, v in headers.items()}
1816

1917

2018
def parse_header_value(header_value: str) -> tuple[str, dict[str, str]]:
2119
main_value, *params = header_value.split(";")
22-
parsed_params = dict(param.strip().split("=", 1) for param in params) # NOSONAR(S7494) force this to dict
20+
parsed_params = dict(param.strip().split("=", 1) for param in params)
2321
parsed_params = {k: v.strip('"') for k, v in parsed_params.items()}
2422
return main_value, parsed_params
2523

lambdas/mns_subscription/src/mns_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
def get_mns_service(mns_env: str = "int"):
1414
boto_config = Config(region_name="eu-west-2")
15-
cache = Cache(directory="/tmp") # NOSONAR(S5443)
15+
cache = Cache(directory="/tmp")
1616
logging.info("Creating authenticator...")
1717
# TODO: MNS and PDS need separate secrets
1818
authenticator = AppRestrictedAuth(

lambdas/shared/src/common/models/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Urls:
6767

6868
NHS_NUMBER = "https://fhir.nhs.uk/Id/nhs-number"
6969
VACCINATION_PROCEDURE = "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-VaccinationProcedure"
70-
SNOMED = "http://snomed.info/sct" # NOSONAR(S5332)
70+
SNOMED = "http://snomed.info/sct"
7171
NHS_NUMBER_VERIFICATION_STATUS_STRUCTURE_DEFINITION = (
7272
"https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-NHSNumberVerificationStatus"
7373
)
@@ -76,7 +76,7 @@ class Urls:
7676
)
7777
ODS_ORGANIZATION_CODE = "https://fhir.nhs.uk/Id/ods-organization-code"
7878
URN_SCHOOL_NUMBER = "https://fhir.hl7.org.uk/Id/urn-school-number"
79-
NULL_FLAVOUR_CODES = "http://terminology.hl7.org/CodeSystem/v3-NullFlavor" # NOSONAR(S5332)
79+
NULL_FLAVOUR_CODES = "http://terminology.hl7.org/CodeSystem/v3-NullFlavor"
8080

8181

8282
class RedisHashKeys:

sonar-project.properties

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ sonar.exclusions=**/proxies/**,**/utilities/scripts/**,**/infrastructure/account
77
sonar.coverage.exclusions=lambdas/shared/src/common/models/batch_constants.py
88
sonar.python.coverage.reportPaths=backend-coverage.xml,delta-coverage.xml,ack-lambda-coverage.xml,filenameprocessor-coverage.xml,recordforwarder-coverage.xml,recordprocessor-coverage.xml,mesh_processor-coverage.xml,redis_sync-coverage.xml,mns_subscription-coverage.xml,id_sync-coverage.xml,shared-coverage.xml,batchprocessorfilter-coverage.xml
99
sonar.cpd.exclusions=**/Dockerfile
10-
sonar.issue.ignore.multicriteria=exclude_snomed_urls,exclude_hl7_urls
11-
sonar.issue.ignore.multicriteria.exclude_snomed_urls.ruleKey=python:S5332
12-
sonar.issue.ignore.multicriteria.exclude_snomed_urls.resourceKey=**http://snomed\.info/sct**
13-
sonar.issue.ignore.multicriteria.exclude_hl7_urls.ruleKey=python:S5332
14-
sonar.issue.ignore.multicriteria.exclude_hl7_urls.resourceKey=**http://terminology\.hl7\.org/CodeSystem/v3-NullFlavor**
15-
sonar.issue.ignore.multicriteria=e1
16-
sonar.issue.ignore.multicriteria.e1.ruleKey=python:S5443
17-
sonar.issue.ignore.multicriteria.e1.resourceKey=**/mns_setup.py
10+
sonar.issue.ignore.multicriteria=exclude_http_urls,exclude_writable_dirs,exclude_force_dict
11+
sonar.issue.ignore.multicriteria.exclude_http_urls.ruleKey=python:S5332
12+
sonar.issue.ignore.multicriteria.exclude_http_urls.resourceKey=**/lambdas/**
13+
sonar.issue.ignore.multicriteria.exclude_writable_dirs.ruleKey=python:S5443
14+
sonar.issue.ignore.multicriteria.exclude_writable_dirs.resourceKey=**/lambdas/**
15+
sonar.issue.ignore.multicriteria.exclude_force_dict.ruleKey=python:S7494
16+
sonar.issue.ignore.multicriteria.exclude_force_dict.resourceKey=**/lambdas/**

0 commit comments

Comments
 (0)