Skip to content

Commit 81f12f5

Browse files
committed
Resolved outstanding Sonar issues
1 parent 6431e2c commit 81f12f5

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

.github/workflows/deploy-backend.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,13 @@ env: # Sonarcloud - do not allow direct usage of untrusted data
4848
ENVIRONMENT: ${{ inputs.environment }}
4949
SUB_ENVIRONMENT: ${{ inputs.sub_environment }}
5050

51-
permissions:
52-
id-token: write
53-
contents: read
54-
5551
run-name: Deploy Backend - ${{ inputs.environment }} ${{ inputs.sub_environment }}
5652

5753
jobs:
5854
terraform-plan:
55+
permissions:
56+
id-token: write
57+
contents: read
5958
runs-on: ubuntu-latest
6059
environment:
6160
name: ${{ inputs.environment }}
@@ -89,6 +88,9 @@ jobs:
8988
path: infrastructure/instance/tfplan
9089

9190
terraform-apply:
91+
permissions:
92+
id-token: write
93+
contents: read
9294
needs: terraform-plan
9395
runs-on: ubuntu-latest
9496
environment:

.github/workflows/run-e2e-tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ permissions:
5959
contents: read
6060

6161
jobs:
62+
permissions:
63+
contents: read
6264
wait-for-deployment:
6365
runs-on: ubuntu-latest
6466
environment: ${{ inputs.apigee_environment }}
@@ -109,6 +111,9 @@ jobs:
109111
fi
110112
111113
e2e-tests:
114+
permissions:
115+
id-token: write
116+
contents: read
112117
runs-on: ubuntu-latest
113118
needs: [wait-for-deployment]
114119
environment: ${{ inputs.apigee_environment }}
@@ -202,6 +207,9 @@ jobs:
202207
run: poetry run python -m unittest
203208

204209
batch-e2e-tests:
210+
permissions:
211+
id-token: write
212+
contents: read
205213
needs: [wait-for-deployment, e2e-tests]
206214
# Only actually depend on wait-for-deployment, but run after e2e-tests
207215
if: ${{ !cancelled() && needs.wait-for-deployment.result == 'success' && needs.wait-for-deployment.outputs.RUN_BATCH_E2E_TESTS == 'true' }}

lambdas/backend/src/controller/parameter_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def parse_search_params(search_params_in_req: dict[str, list[str]]) -> dict[str,
166166
"""Ensures the search params provided in the event do not contain duplicated keys. Will split the parameters
167167
provided by comma separators. Raises a ParameterExceptionError for duplicated keys. Existing business logic stipulated
168168
that the API only accepts comma separated values rather than multi-value."""
169-
if any([len(values) > 1 for _, values in search_params_in_req.items()]):
169+
if any(len(values) > 1 for _, values in search_params_in_req.items()):
170170
raise ParameterExceptionError(DUPLICATED_PARAMETERS_ERROR_MESSAGE)
171171

172172
parsed_params = {}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def to_operation_outcome(self) -> dict:
6767

6868
class ApiValidationError(RuntimeError):
6969
def to_operation_outcome(self) -> dict:
70-
pass
70+
raise NotImplementedError("Improper usage: base class")
7171

7272

7373
@dataclass

lambdas/shared/tests/test_common/test_errors.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,6 @@ def test_errors_unhandled_response_error(self):
128128
self.assertEqual(issue.get("code"), errors.Code.exception)
129129
self.assertEqual(issue.get("diagnostics"), f"{test_message}\n{test_response}")
130130

131-
def test_errors_api_validation_error(self):
132-
"""Test correct operation of ApiValidationError"""
133-
with self.assertRaises(errors.ApiValidationError) as context:
134-
raise errors.ApiValidationError()
135-
outcome = context.exception.to_operation_outcome()
136-
self.assertIsNone(outcome)
137-
138131
def test_errors_custom_validation_error(self):
139132
"""Test correct operation of CustomValidationError"""
140133
test_message = "test_message"

0 commit comments

Comments
 (0)