Showing 6 of 21 total issues
Function respondToAccessTokenRequest
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
async respondToAccessTokenRequest(req: RequestInterface, accessTokenTTL: DateInterval): Promise<ResponseInterface> {
const client = await this.validateClient(req);
const encryptedAuthCode = this.getRequestParameter("code", req);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validateAuthorizationRequest
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async validateAuthorizationRequest(request: RequestInterface): Promise<AuthorizationRequest> {
const clientId = this.getQueryStringParameter("client_id", request);
if (typeof clientId !== "string") {
throw OAuthException.invalidParameter("client_id");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validateOldRefreshToken
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private async validateOldRefreshToken(request: RequestInterface, clientId: string): Promise<OAuthToken> {
const encryptedRefreshToken = this.getRequestParameter("refresh_token", request);
if (!encryptedRefreshToken) {
throw OAuthException.invalidParameter("refresh_token");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validateAuthorizationCode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private async validateAuthorizationCode(payload: any, client: OAuthClient, request: RequestInterface) {
if (!payload.auth_code_id) {
throw OAuthException.invalidParameter("code", "Authorization code malformed");
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function completeAuthorizationRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async completeAuthorizationRequest(authorizationRequest: AuthorizationRequest): Promise<ResponseInterface> {
if (!authorizationRequest.user || !authorizationRequest.user?.id) {
throw OAuthException.badRequest("A user must be set on the AuthorizationRequest");
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function enableGrantType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
enableGrantType(toEnable: EnableGrant, accessTokenTTL: DateInterval = new DateInterval("1h")): void {
if (Array.isArray(toEnable)) {
const [grantType, ttl] = toEnable;
accessTokenTTL = ttl;
toEnable = grantType;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"