integreat-io/integreat-authenticator-oauth2

View on GitHub

Showing 7 of 7 total issues

Function authenticate has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export default async function authenticate(
options: Partial<AuthOptions> | null,
_action: Action | null,
_dispatch: HandlerDispatch,
authentication: Authentication | null,
Severity: Minor
Found in src/authenticate.ts - About 3 hrs to fix

Function authenticate has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default async function authenticate(
options: Partial<AuthOptions> | null,
_action: Action | null,
_dispatch: HandlerDispatch,
authentication: Authentication | null,
Severity: Major
Found in src/authenticate.ts - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export interface RefreshOptions {
    grantType: 'refreshToken'
    uri: string
    key: string
    secret: string
    Severity: Major
    Found in src/types.ts and 1 other location - About 1 hr to fix
    src/types.ts on lines 12..20

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export interface AuthCodeOptions {
    grantType: 'authorizationCode'
    uri: string
    key: string
    secret: string
    Severity: Major
    Found in src/types.ts and 1 other location - About 1 hr to fix
    src/types.ts on lines 22..30

    Avoid too many return statements within this function.
    Open

    return { status: 'error', error: 'Invalid json response' }
    Severity: Major
    Found in src/authenticate.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

      return { status: 'error', error: response.statusText }
      Severity: Major
      Found in src/authenticate.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

        return {
        status: 'refused',
        error: data?.error_description
        ? `Refused by service: ${data?.error_description}`
        : 'Refused by service',
        Severity: Major
        Found in src/authenticate.ts - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language