jdalrymple/gitbeaker

View on GitHub

Showing 12 of 45 total issues

Function getGlobalConfig has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function getGlobalConfig(env = process.env): GlobalCLIConfig {
  const normalEnv = normalizeEnviromentVariables(env);

  return {
    'gb-token': {
Severity: Major
Found in packages/cli/src/utils.ts - About 2 hrs to fix

    Function getManyMore has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    async function getManyMore<
      T extends Record<string, unknown>[],
      E extends boolean,
      P extends PaginationTypes = PaginationTypes,
    >(
    Severity: Minor
    Found in packages/core/src/infrastructure/RequestHelper.ts - About 1 hr to fix

    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 edit has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      edit<E extends boolean = false>(
        planName: string,
        options: ApplicationPlanLimitOptions & Sudo & ShowExpanded<E> = {},
      ): Promise<GitlabAPIResponse<ApplicationPlanLimitSchema, C, E, void>> {
        const {
    Severity: Minor
    Found in packages/core/src/resources/ApplicationPlanLimits.ts - About 1 hr to fix

      Function getManyMore has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function getManyMore<
        T extends Record<string, unknown>[],
        E extends boolean,
        P extends PaginationTypes = PaginationTypes,
      >(
      Severity: Minor
      Found in packages/core/src/infrastructure/RequestHelper.ts - About 1 hr to fix

        Function defaultRequestHandler has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export async function defaultRequestHandler(endpoint: string, options?: RequestOptions) {
          const retryCodes = [429, 502];
          const maxRetries = 10;
          const { prefixUrl, asStream, searchParams, rateLimiters, method, ...opts } = options || {};
          const rateLimit = getMatchingRateLimiter(endpoint, rateLimiters, method);
        Severity: Minor
        Found in packages/rest/src/Requester.ts - About 1 hr to fix

        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 get has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function get<
          T extends ResponseBodyTypes = Record<string, unknown>,
        >(): getOverloadImproved<T> {
          return async <C extends boolean, E extends boolean>(
            service: BaseResource<C>,
        Severity: Minor
        Found in packages/core/src/infrastructure/RequestHelper.ts - About 1 hr to fix

          Function defaultRequestHandler has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export async function defaultRequestHandler(endpoint: string, options?: RequestOptions) {
            const retryCodes = [429, 502];
            const maxRetries = 10;
            const { prefixUrl, asStream, searchParams, rateLimiters, method, ...opts } = options || {};
            const rateLimit = getMatchingRateLimiter(endpoint, rateLimiters, method);
          Severity: Minor
          Found in packages/rest/src/Requester.ts - About 1 hr to fix

            Function getManyMore has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              camelize: boolean,
              getFn: RequestHandlerFn<T>,
              endpoint: string,
              response: FormattedResponse<T>,
              requestOptions: { maxPages?: number } & PaginationRequestOptions<P> & BaseRequestOptions<E>,
            Severity: Minor
            Found in packages/core/src/infrastructure/RequestHelper.ts - About 45 mins to fix

              Function url has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                resourceId: number | string,
                resourceType2: string,
                resourceId2: number | string,
                noteId: number,
                awardId?: number,
              Severity: Minor
              Found in packages/core/src/templates/ResourceNoteAwardEmojis.ts - About 35 mins to fix

                Function defaultOptionsHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export async function defaultOptionsHandler(
                  resourceOptions: ResourceOptions,
                  {
                    body,
                    searchParams,
                Severity: Minor
                Found in packages/requester-utils/src/RequesterUtils.ts - About 35 mins to fix

                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 edit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  edit<E extends boolean = false>(
                    {
                      logo,
                      pwaIcon,
                      ...options
                Severity: Minor
                Found in packages/core/src/resources/ApplicationAppearance.ts - About 25 mins to fix

                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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  constructor({
                    sudo,
                    profileToken,
                    camelize,
                    requesterFn,
                Severity: Minor
                Found in packages/requester-utils/src/BaseResource.ts - About 25 mins to fix

                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

                Severity
                Category
                Status
                Source
                Language