Skip to content

[HOTE-803] fix: pre-commit all files#366

Open
mikeeq wants to merge 2 commits intomainfrom
feature/hote-803/pre-commit-all
Open

[HOTE-803] fix: pre-commit all files#366
mikeeq wants to merge 2 commits intomainfrom
feature/hote-803/pre-commit-all

Conversation

@mikeeq
Copy link
Copy Markdown
Collaborator

@mikeeq mikeeq commented Apr 16, 2026

Description

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

Copilot AI review requested due to automatic review settings April 16, 2026 13:30
const mockRetrieveOptionalEnvVariable = utils.retrieveOptionalEnvVariable as jest.MockedFunction<
typeof utils.retrieveOptionalEnvVariable
>;
const MockPostcodeLookupService = PostcodeLookupService as jest.MockedClass<
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

UI Coverage Report

Lines Statements Branches Functions
Coverage: 96%
96.25% (5658/5878) 88.22% (682/773) 88.06% (214/243)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR appears to be a repo-wide pre-commit/prettier normalization pass (quotes, import ordering, whitespace, line wrapping) to ensure “pre-commit all files” runs cleanly.

Changes:

  • Applied consistent formatting (double quotes, trailing commas, import order, line wrapping) across UI, lambdas, tests, scripts, and docs.
  • Normalized JSON/Markdown/YAML formatting to satisfy linters (markdownlint, eslint/prettier).
  • Updated various unit tests for formatting consistency.

Reviewed changes

Copilot reviewed 156 out of 160 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ui/src/state/index.ts Formatting (quote style) normalization.
ui/src/routes/get-self-test-kit-for-HIV-journey/NoAddressFoundPage.tsx Import order normalization.
ui/src/routes/get-self-test-kit-for-HIV-journey/KitNotAvailableInAreaPage.tsx Import order normalization.
ui/src/routes/get-self-test-kit-for-HIV-journey/HowComfortablePrickingFingerPage.tsx Import order normalization.
ui/src/routes/get-self-test-kit-for-HIV-journey/GoToClinicPage.tsx Import order + JSX formatting normalization.
ui/src/routes/get-self-test-kit-for-HIV-journey/FormSuppliersTermsConditionsPage.tsx Import order normalization.
ui/src/routes/get-self-test-kit-for-HIV-journey/FormSuppliersPrivacyPolicyPage.tsx Import order normalization.
ui/src/routes/get-self-test-kit-for-HIV-journey/BloodSampleGuidePage.tsx Import order normalization.
ui/src/routes/TestResultsPage.tsx Import order normalization.
ui/src/routes/SuppliersTermsConditionsPage.tsx Import order normalization.
ui/src/routes/SuppliersPrivacyPolicyPage.tsx Import order normalization.
ui/src/routes/ServiceErrorPage.tsx Import order/spacing normalization.
ui/src/routes/CallbackPage.tsx Import order normalization.
ui/src/lib/utils/fhir-utils.ts Formatting/line wrapping normalization.
ui/src/lib/utils/debug.ts Quote style normalization.
ui/src/lib/utils/JourneyDevtools.tsx Spacing/import grouping normalization.
ui/src/lib/utils/AppDevtools.tsx Spacing/import grouping normalization.
ui/src/lib/services/test-results-service.ts Import order + formatting normalization.
ui/src/lib/services/order-service.ts Quote style + formatting normalization.
ui/src/lib/services/order-details-service.ts Formatting normalization (but includes a functional error-handling regression).
ui/src/lib/queries/test-results-query.ts Import order normalization.
ui/src/lib/mappers/order-details-mapper.ts Spacing normalization.
ui/src/layouts/MainLayout.tsx Import order normalization.
ui/src/layouts/JourneyLayout.tsx Import order normalization.
ui/src/components/NearestSexualHealthClinicSection.tsx Function formatting normalization.
ui/src/components/FindAnotherSexualHealthClinicLink.tsx Spacing normalization.
ui/src/components/ErrorRedirect.tsx Spacing normalization.
ui/src/app/[[...slug]]/page.tsx Import order normalization.
ui/src/tests/routes/get-self-test-kit-for-HIV-journey/KitNotAvailableInAreaPage.test.tsx Import order/spacing normalization.
ui/src/tests/routes/get-self-test-kit-for-HIV-journey/HowComfortablePrickingFingerPage.test.tsx Import order normalization.
ui/src/tests/routes/get-self-test-kit-for-HIV-journey/GoToClinicPage.test.tsx Import order/spacing normalization.
ui/src/tests/routes/get-self-test-kit-for-HIV-journey/GetSelfTestKitPage.test.tsx Import order normalization.
ui/src/tests/routes/get-self-test-kit-for-HIV-journey/FormSuppliersTermsConditionsPage.test.tsx Spacing normalization.
ui/src/tests/routes/get-self-test-kit-for-HIV-journey/FormSuppliersPrivacyPolicyPage.test.tsx Spacing normalization.
ui/src/tests/routes/get-self-test-kit-for-HIV-journey/EnterMobileNumberPage.test.tsx Import order normalization.
ui/src/tests/routes/get-self-test-kit-for-HIV-journey/EnterDeliveryAddressPage.test.tsx Import order/spacing normalization.
ui/src/tests/routes/get-self-test-kit-for-HIV-journey/ConfirmMobileNumberPage.test.tsx Import order normalization.
ui/src/tests/routes/TestResultsPage.test.tsx Import order/spacing normalization.
ui/src/tests/routes/SuppliersTermsConditionsPage.test.tsx Import order/spacing normalization.
ui/src/tests/routes/SuppliersPrivacyPolicyPage.test.tsx Import order/spacing normalization.
ui/src/tests/routes/ServiceErrorPage.test.tsx Formatting normalization (expect wrapping).
ui/src/tests/lib/validation/mobileNumberValidation.test.ts Formatting/line wrapping normalization.
ui/src/tests/lib/utils/fhir-utils.test.ts Formatting/line wrapping normalization.
ui/src/tests/lib/utils/debug.test.ts Formatting/line wrapping normalization.
ui/src/tests/lib/utils/JourneyDevtools.test.tsx Formatting normalization.
ui/src/tests/lib/utils/AppDevtools.test.tsx Formatting normalization.
ui/src/tests/lib/services/test-results-service.test.ts Import order/formatting normalization.
ui/src/tests/lib/services/order-service.test.ts Formatting normalization.
ui/src/tests/lib/services/order-details-service.test.ts Formatting normalization.
ui/src/tests/layouts/PageLayout.test.tsx Spacing normalization.
ui/src/tests/hooks/useThrowError.test.tsx Import order/spacing normalization.
ui/src/tests/components/order-status/OrderStatusHeader.test.tsx Import order normalization.
ui/src/tests/components/order-status/OrderStatus.test.tsx Import order/spacing normalization.
ui/src/tests/components/SupplierLegalDocumentContent.test.tsx Spacing normalization.
ui/src/tests/components/MoreOptionsAndInformation.test.tsx Expect formatting normalization.
ui/src/tests/components/MedicalAbbreviationsHelp.test.tsx Expect formatting normalization.
ui/src/tests/components/ErrorRedirect.test.tsx Import order/spacing normalization.
ui/src/tests/components/AboutService.test.tsx Import order normalization.
ui/jest.config.ts Quote style + formatting normalization.
ui/hooks/useThrowError.ts Import order normalization.
ui/hooks/useContent.ts Type import ordering normalization.
ui/eslint.config.mjs Import order normalization.
ui/content/schema.ts Type formatting normalization.
ui/content/index.ts Export indentation normalization.
ui/content/hometest-terms-of-use.json JSON array formatting normalization.
ui/content/hometest-privacy-policy.json JSON array formatting normalization.
ui/content/content.json JSON formatting normalization.
ui/content/README.md Import order in docs snippet normalization.
ui/content/ContentService.ts Import grouping/order normalization.
ui/README.md Markdown spacing/formatting normalization.
tests/utils/users/index.ts Quote style normalization.
tests/utils/users/SandBoxUserManager.ts Import order normalization.
tests/utils/AccessibilityModule.ts Import order + formatting normalization.
tests/tests/ui/ServiceNavigationTest.spec.ts Import order normalization.
tests/tests/ui/KitUnavailableTest.spec.ts Spacing normalization.
tests/tests/ui/GoToClinicTest.spec.ts Spacing normalization.
tests/test-data/GetOrderRequestParams.ts Trailing comma/formatting normalization.
tests/page-objects/TermsOfUsePage.ts Spacing normalization.
tests/page-objects/PrivacyPolicyPage.ts Spacing normalization.
tests/page-objects/OrderSubmittedPage.ts Spacing normalization.
tests/page-objects/NhsLoginHelper.ts Import order + formatting normalization.
tests/page-objects/NHSLogin/NHSEmailAndPasswordPage.ts Spacing normalization.
tests/page-objects/NHSLogin/CodeSecurityPage.ts Quote style + formatting normalization.
tests/page-objects/KitNotAvailableInYourAreaPage.ts Locator formatting normalization.
tests/page-objects/GoToClinicPage.ts Spacing normalization.
tests/page-objects/EnterDeliveryAddressPage.ts Import order normalization.
tests/page-objects/ConfirmMobileNumberPage.ts Import order normalization.
tests/page-objects/BloodSampleGuidePage.ts Spacing normalization.
tests/page-objects/BasePage.ts Quote style normalization.
tests/models/TestResult.ts Quote style normalization.
tests/models/CreateOrderResponse.ts Return formatting normalization.
tests/fixtures/pageObjectsFixture.ts Import ordering normalization.
tests/fixtures/configurationFixture.ts Quote style + formatting normalization.
tests/fixtures/apiFixture.ts Spacing normalization.
tests/fixtures/accessibilityFixture.ts Quote style + formatting normalization.
tests/eslint.config.mjs Import order normalization.
tests/docs/guides/PullRequestGuidelines.md Markdown/code sample formatting normalization.
tests/db/TestResultDbClient.ts Import order normalization.
tests/api/clients/OrderStatusApiResource.ts Import order normalization.
tests/api/clients/OrderApiResource.ts Formatting + method signature line wrapping normalization.
scripts/nhslogin/sign_jwt.js Quote style + formatting normalization.
scripts/config/markdownlint.yaml YAML spacing normalization.
project.code-workspace JSONC trailing comma/formatting normalization.
lambdas/src/postcode-lookup-lambda/index.test.ts Quote style + formatting normalization.
lambdas/src/order-service-lambda/order-service-request-schema.ts Import spacing/order normalization.
lambdas/src/order-service-lambda/index.test.ts Import spacing/order normalization.
lambdas/src/order-service-lambda/fhir-mapper.ts Type import + formatting normalization.
lambdas/src/order-service-lambda/fhir-mapper.test.ts Formatting normalization.
lambdas/src/order-result-lambda/validation-service.ts Import order normalization.
lambdas/src/order-result-lambda/validation-service.test.ts Import order normalization.
lambdas/src/order-result-lambda/models.ts Quote style + formatting normalization.
lambdas/src/login-lambda/login-service.ts Import order normalization.
lambdas/src/login-lambda/login-service.test.ts Import order normalization.
lambdas/src/lib/validators/observation-validation.test.ts Spacing/formatting normalization.
lambdas/src/lib/utils/validation-utils.ts Quote style normalization.
lambdas/src/lib/utils/validation-utils.test.ts Indentation/formatting normalization.
lambdas/src/lib/test-utils/environment-test-helpers.ts Signature formatting normalization.
lambdas/src/lib/test-utils/component-integration-helpers.ts Signature formatting normalization.
lambdas/src/lib/secrets/secrets-manager-client.test.ts Import order + formatting normalization.
lambdas/src/lib/postcode-lookup/stub/stub-client.ts Import order normalization.
lambdas/src/lib/postcode-lookup/postcode-lookup-service.ts Import order normalization.
lambdas/src/lib/postcode-lookup/postcode-lookup-service.test.ts Quote style + formatting normalization.
lambdas/src/lib/postcode-lookup/models/postcode-lookup-response.ts Quote style normalization.
lambdas/src/lib/login/token-service.ts Import spacing/order normalization.
lambdas/src/lib/login/token-service.test.ts Import order normalization.
lambdas/src/lib/login/test-user-mapping.ts Quote style + formatting normalization.
lambdas/src/lib/login/nhs-login-jwt-helper.ts Import order normalization.
lambdas/src/lib/login/nhs-login-jwt-helper.test.ts Import order normalization.
lambdas/src/lib/login/nhs-login-client.ts Import order normalization.
lambdas/src/lib/http/security-headers.ts Trailing comma + quote style normalization.
lambdas/src/lib/http/login-http-client.ts Import order + formatting normalization.
lambdas/src/lib/http/http-client.test.ts Expect formatting normalization.
lambdas/src/lib/fhir-response.ts Import order normalization.
lambdas/src/lib/db/transaction-db-client.ts Import order normalization.
lambdas/src/lib/db/test-result-db-client.ts Formatting normalization.
lambdas/src/lib/db/test-result-db-client.test.ts Formatting normalization.
lambdas/src/lib/db/rds-iam-auth.ts Signature formatting normalization.
lambdas/src/lib/db/db-client.ts Import order + signature formatting normalization.
lambdas/src/lib/db/db-client.test.ts Formatting normalization.
lambdas/src/lib/commons.ts Formatting normalization (but still uses console.log patterns).
lambdas/src/lib/auth/auth-utils.ts Quote style + formatting normalization.
lambdas/src/lib/auth/auth-token-verifier.ts Spacing normalization.
lambdas/src/lib/auth/auth-token-verifier.test.ts Import order normalization.
lambdas/src/lib/auth/auth-token-service.ts Spacing normalization.
lambdas/src/lib/auth/auth-token-service.test.ts Import order normalization.
lambdas/src/hello-world-lambda/index.ts Formatting normalization (still logs full event).
lambdas/src/get-order-lambda/order-bundle-builder.ts Formatting normalization.
lambdas/src/get-order-lambda/index.test.ts Formatting normalization.
lambdas/src/eligibility-lookup-lambda/la-lookup.test.ts Jest mock formatting normalization.
lambdas/scripts/package.ts Quote style + formatting normalization.
lambdas/scripts/build.ts Import order normalization.
lambdas/eslint.config.mjs Import order normalization.
docs/user-guides/Sign_Git_commits.md Markdown code block formatting normalization.
docs/user-guides/Scan_dependencies.md Markdown whitespace normalization.
docs/developer-guides/Scripting_Terraform.md Markdown spacing/line wrapping normalization.
docs/developer-guides/Scripting_Docker.md Markdown spacing/line wrapping normalization.
.markdownlint.yaml YAML indentation normalization.
.github/instructions/ui.instructions.md Markdown/code snippet formatting normalization.
.github/instructions/tests.instructions.md Markdown/code snippet formatting normalization.
.github/PULL_REQUEST_TEMPLATE.md Markdown whitespace normalization.
Comments suppressed due to low confidence (1)

tests/utils/AccessibilityModule.ts:76

  • This test utility uses multiple console.log calls for normal flow output; per the repo test conventions, prefer the shared Logger utility (or remove the logging) to keep test output clean and consistent in CI.

Comment on lines +3 to 10
export const handler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
console.log(event);
return {
statusCode: 200,
body: JSON.stringify({
message: 'Hello world!',
})
message: "Hello world!",
}),
};
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hello-world lambda logs the entire API Gateway event with console.log, which can leak sensitive headers/cookies and also violates the lambda logging conventions (use console.info/console.error with a correlation id, and avoid logging full request objects).

Copilot uses AI. Check for mistakes.
Comment on lines 19 to 25
const errorMessage =
issue?.details?.text ??
issue?.diagnostics ??
issue?.code ??
"Unknown error";
issue?.details?.text ?? issue?.diagnostics ?? issue?.code ?? "Unknown error";
if (errorMessage === "") throw new Error(errorMessage);
}

const bundle: Bundle = await response.json();
return OrderDetailsMapper.mapBundleToOrderDetails(bundle);
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error branch never throws for non-empty OperationOutcome messages because it only throws when errorMessage === "", so non-200 responses (except not-found) will fall through and then try to parse the same response body as a Bundle (likely causing a runtime failure or incorrect UI state).

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +15
console.log(`[${new Date().toISOString()}][INFO][${module}] - ${msg}`, details);
}
logDebug(module: string, msg: string, details?: Record<string, any>): void {
console.debug(`[${new Date().toISOString()}][INFO][${module}] - ${msg}`, details);
}
logError(module: string, msg: string, details?: Record<string, any>): void {
console.error(`[${new Date().toISOString()}][INFO][${module}] - ${msg}`, details);
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConsoleCommons.logInfo uses console.log (and logDebug/logError label messages as [INFO]), which breaks the repo logging rules for lambdas and makes log levels misleading when troubleshooting in CloudWatch.

Suggested change
console.log(`[${new Date().toISOString()}][INFO][${module}] - ${msg}`, details);
}
logDebug(module: string, msg: string, details?: Record<string, any>): void {
console.debug(`[${new Date().toISOString()}][INFO][${module}] - ${msg}`, details);
}
logError(module: string, msg: string, details?: Record<string, any>): void {
console.error(`[${new Date().toISOString()}][INFO][${module}] - ${msg}`, details);
console.info(`[${new Date().toISOString()}][INFO][${module}] - ${msg}`, details);
}
logDebug(module: string, msg: string, details?: Record<string, any>): void {
console.debug(`[${new Date().toISOString()}][DEBUG][${module}] - ${msg}`, details);
}
logError(module: string, msg: string, details?: Record<string, any>): void {
console.error(`[${new Date().toISOString()}][ERROR][${module}] - ${msg}`, details);

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@lewisbirks lewisbirks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want a subsequent follow up PR that populates an ignore revs file?

@@ -1,13 +1,11 @@
import {APIGatewayProxyEvent, APIGatewayProxyResult} from "aws-lambda";
import { APIGatewayProxyEvent, APIGatewayProxyResult } from "aws-lambda";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to just remove this lambda? Maybe a subsequent PR?

Comment thread project.code-workspace
@@ -2,7 +2,7 @@
"folders": [
{
"name": "Repository Template",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this file produce any value? Don't use VS Code so I don't know, just feels odd with the name

Comment thread lambdas/src/lib/auth/auth-token-service.test.ts Outdated
@github-actions
Copy link
Copy Markdown

Lambdas Coverage Report

Lines Statements Branches Functions
Coverage: 98%
98.44% (1646/1672) 92.37% (448/485) 97.05% (264/272)

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants