Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix some Sonar findings #71

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/httpClient/testHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class TestHttpClient implements BasicHttpClient {
const resolvedObj = resolvedHttpRequest.resolveTo;
if (resolvedObj) {
const httpResult: HttpResult<TDto> = {
body: resolvedObj as TDto,
body: resolvedObj,
statusCode: resolvedHttpRequest.resolveStatusCode ?? 200,
};
return Promise.resolve(httpResult);
Expand Down
4 changes: 1 addition & 3 deletions src/common/httpClient/testHttpClientHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ export class TestHttpClientHandler {
if (!a || !b) {
return false;
}
const equal = this.aEntriesPresentInB(a, b, ignoreKeys) && this.aEntriesPresentInB(b, a, ignoreKeys);
// console.log(`${Object.entries(a)} : ${Object.entries(b)} => equal: ${equal}`);
return equal;
return this.aEntriesPresentInB(a, b, ignoreKeys) && this.aEntriesPresentInB(b, a, ignoreKeys);
}

private aEntriesPresentInB(a: QueryParams, b: QueryParams, ignoreKeys: string[] | undefined) {
Expand Down
2 changes: 1 addition & 1 deletion src/fft-api/common/fftApiClientService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class FftApiClient {
retries: method === HttpMethod.GET ? MAX_RETRIES : 0,
responseType,
});
return result.body as T;
return result.body;
} catch (error) {
handleError(error);
}
Expand Down
16 changes: 7 additions & 9 deletions src/fft-api/facility/fftFacilityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class FftFacilityService {

public async getFacilityId(tenantFacilityId: string, relaxed = false): Promise<string | undefined> {
if (FftFacilityService.facilityCache.has(tenantFacilityId)) {
return FftFacilityService.facilityCache.get(tenantFacilityId) as string;
return FftFacilityService.facilityCache.get(tenantFacilityId);
}

const strippedFacilities = await this.apiClient.get<StrippedFacilities>(this.PATH, { tenantFacilityId });
Expand All @@ -46,15 +46,13 @@ export class FftFacilityService {
`Did not find exactly 1 facility with tenantFacilityId '${tenantFacilityId}' but ${length}, returning first one with id '${facility.id}'`
);
}
} else if (relaxed) {
return undefined;
} else {
if (relaxed) {
return undefined;
} else {
console.error(`Did not find facility with tenantFacilityId '${tenantFacilityId}'`);
throw new FftApiError({
message: `Did not find facility with tenantFacilityId '${tenantFacilityId}'`,
});
}
console.error(`Did not find facility with tenantFacilityId '${tenantFacilityId}'`);
throw new FftApiError({
message: `Did not find facility with tenantFacilityId '${tenantFacilityId}'`,
});
}

return facility.id;
Expand Down