Skip to content

Commit

Permalink
fix(chore): fixed the parentheses sonar issues
Browse files Browse the repository at this point in the history
fixed the parentheses sonar issues

GH-142
  • Loading branch information
arpit1503khanna committed Nov 22, 2023
1 parent 052acc7 commit a48577c
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"bracketSpacing": false,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "all"
"trailingComma": "all",
"arrowParens": "avoid"
}
2 changes: 1 addition & 1 deletion src/providers/client-authentication.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ClientAuthenticateActionProvider
) {}

value(): AuthenticateFn<IAuthClient | undefined> {
return (request) => this.action(request);
return request => this.action(request);
}

async action(request: Request): Promise<IAuthClient | undefined> {
Expand Down
12 changes: 6 additions & 6 deletions src/release_notes/post-processing.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ module.exports = async function (data, callback) {
const commitTitle = commit.title;
commit.title = commitTitle.substring(0, commitTitle.indexOf('#') - 1);

commit.messageLines = commit.messageLines.filter((message) => {
commit.messageLines = commit.messageLines.filter(message => {
if (message.indexOf('efs/remotes/origin') === -1) return message;
});

commit.messageLines.forEach((message) => {
commit.messageLines.forEach(message => {
commit.issueno = message.includes('GH-')
? message.replace('GH-', '').trim()
: null;
});

const issueDesc = await getIssueDesc(commit.issueno).then((res) => {
const issueDesc = await getIssueDesc(commit.issueno).then(res => {
return res;
});
commit.issueTitle = issueDesc;
Expand Down Expand Up @@ -48,9 +48,9 @@ function getIssueDesc(issueNo) {
`https://github.com/sourcefuse/loopback4-authentication/issues/${encodeURIComponent(
issueNo,
)}`,
(res) => {
res => {
res.setEncoding('utf8');
res.on('data', (chunk) => {
res.on('data', chunk => {
result = result + chunk;
});
res.on('end', () => {
Expand All @@ -69,7 +69,7 @@ function getIssueDesc(issueNo) {
});
},
);
req.on('error', (e) => {
req.on('error', e => {
reject(e);
});
req.end();
Expand Down
2 changes: 1 addition & 1 deletion src/release_notes/release-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async function addAndCommit() {
await git.push('origin', 'master');
}

generateReleaseNotes().catch((ex) => {
generateReleaseNotes().catch(ex => {
console.error(ex);
process.exit(1);
});
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export class ClientPasswordStrategyFactoryProvider
req: Request | undefined,
) => {
verifyFn(clientId, clientSecret, req)
.then((client) => {
.then(client => {
this.clientPasswordVerifierHelper(client, clientSecret);
cb(null, client);
})
.catch((err) => {
.catch(err => {
cb(err);
});
},
Expand All @@ -72,11 +72,11 @@ export class ClientPasswordStrategyFactoryProvider
cb: (err: Error | null, client?: IAuthClient | null) => void,
) => {
verifyFn(clientId, clientSecret)
.then((client) => {
.then(client => {
this.clientPasswordVerifierHelper(client, clientSecret);
cb(null, client);
})
.catch((err) => {
.catch(err => {
cb(err);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ export class SecureClientPasswordStrategyFactoryProvider
req: Request | undefined,
) => {
verifyFn(clientId, clientSecret, req)
.then((client) => {
.then(client => {
this.secureClientPasswordVerifierHelper(client, clientSecret);
cb(null, client);
})
.catch((err) => {
.catch(err => {
cb(err);
});
},
Expand All @@ -75,11 +75,11 @@ export class SecureClientPasswordStrategyFactoryProvider
cb: (err: Error | null, client?: IAuthSecureClient | null) => void,
) => {
verifyFn(clientId, clientSecret)
.then((client) => {
.then(client => {
this.secureClientPasswordVerifierHelper(client, clientSecret);
cb(null, client);
})
.catch((err) => {
.catch(err => {
cb(err);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export class PassportOtpStrategyFactoryProvider
options,
(key: string, otp: string, cb: Otp.VerifyCallback) => {
verifyFn(key, otp)
.then((user) => {
.then(user => {
if (!user) {
throw new HttpErrors.Unauthorized(
AuthErrorKeys.InvalidCredentials,
);
}
cb(null, user);
})
.catch((err) => {
.catch(err => {
cb(err);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ export class ResourceOwnerPasswordStrategyFactoryProvider
) => void,
) => {
verifyFn(clientId, clientSecret, username, password, req)
.then((userInfo) => {
.then(userInfo => {
if (!userInfo || isEmpty(userInfo)) {
throw new HttpErrors.Unauthorized(AuthErrorKeys.InvalidCredentials);
}
cb(null, userInfo.client, userInfo.user);
})
.catch((err) => {
.catch(err => {
cb(err);
});
};
Expand All @@ -89,13 +89,13 @@ export class ResourceOwnerPasswordStrategyFactoryProvider
) => void,
) => {
verifyFn(clientId, clientSecret, username, password)
.then((userInfo) => {
.then(userInfo => {
if (!userInfo || isEmpty(userInfo)) {
throw new HttpErrors.Unauthorized(AuthErrorKeys.InvalidCredentials);
}
cb(null, userInfo.client, userInfo.user);
})
.catch((err) => {
.catch(err => {
cb(err);
});
};
Expand Down
2 changes: 1 addition & 1 deletion src/strategies/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,5 @@ export namespace VerifyFunction {
): Promise<T | null>;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type GenericAuthFn<T = any> = (...params: any) => Promise<T | null>;
export type GenericAuthFn<T = any> = (...params: any) => Promise<T | null>; // NOSONAR
}
4 changes: 2 additions & 2 deletions vendor/passport-apple/src/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function Strategy(options, verify) {
// Generate the client_secret using the library
_tokenGenerator
.generate()
.then((client_secret) => {
.then(client_secret => {
params = params || {};
const codeParam =
params.grant_type === 'refresh_token' ? 'refresh_token' : 'code';
Expand Down Expand Up @@ -107,7 +107,7 @@ function Strategy(options, verify) {
},
);
})
.catch((error) => {
.catch(error => {
callback(error);
});
};
Expand Down
4 changes: 2 additions & 2 deletions vendor/passport-apple/src/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ class AppleClientSecret {
exp,
this._config.key_id,
)
.then((token) => {
.then(token => {
resolve(token);
})
.catch((err) => {
.catch(err => {
reject(err);
});
});
Expand Down

0 comments on commit a48577c

Please sign in to comment.