Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
linting error removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Bharatkk-metron committed Jul 24, 2024
1 parent 6b4b8fc commit dcff052
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/provider/SonarqubeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ export class SonarqubeClient {
}

async fetchSystemInfo() {
return this.makeSingularRequest('/system/info') as Promise<
SonarqubeSystemInfo
>;
return this.makeSingularRequest(
'/system/info',
) as Promise<SonarqubeSystemInfo>;
}

async iterateProjects(
Expand Down Expand Up @@ -161,9 +161,9 @@ export class SonarqubeClient {
}

async fetchAuthenticationValidate(): Promise<ValidationResponse> {
return this.makeSingularRequest('/authentication/validate') as Promise<
ValidationResponse
>;
return this.makeSingularRequest(
'/authentication/validate',
) as Promise<ValidationResponse>;
}

private async makeRequest(
Expand Down Expand Up @@ -242,10 +242,22 @@ export class SonarqubeClient {

const paginationQueryParms = PaginationQueryParams[endpointVersion];

const sanitizedParams: Record<string, string> = {};
if (params) {
Object.keys(params).forEach((key) => {
const value = params[key];
if (value !== undefined) {
sanitizedParams[key] = Array.isArray(value)
? value.join(',')
: value;
}
});
}

const searchParams = new URLSearchParams({
[paginationQueryParms.pageIndex]: String(page),
[paginationQueryParms.pageSize]: String(ITEMS_PER_PAGE),
...params,
...sanitizedParams,
});

const parametizedEndpoint = `${endpoint}?${searchParams.toString()}`;
Expand Down

0 comments on commit dcff052

Please sign in to comment.