uyu423/r2curl

View on GitHub

Showing 8 of 8 total issues

Consider simplifying this complex logical expression.
Open

  if (
    value === undefined ||
    value === null ||
    ((typeof value === 'number' && isNaN(value)) ||
      (typeof value === 'string' && value === '') ||
Severity: Critical
Found in src/lib/isEmpty.ts - About 2 hrs to fix

    Function method has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      get method(): HTTP_METHOD {
        if (isEmpty(this._prop.method)) {
          return HTTP_METHOD.GET;
        }
        const method = this._prop.method.toUpperCase();
    Severity: Minor
    Found in src/adapter/AxiosRequestConfigAdapter.ts - About 1 hr to fix

      Function isEmpty has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      export function isEmpty<T>(value: T | null | undefined): value is null | undefined {
        if (
          value === undefined ||
          value === null ||
          ((typeof value === 'number' && isNaN(value)) ||
      Severity: Minor
      Found in src/lib/isEmpty.ts - About 55 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

      Avoid too many return statements within this function.
      Open

              return HTTP_METHOD.DELETE;
      Severity: Major
      Found in src/adapter/AxiosRequestConfigAdapter.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return HTTP_METHOD.PATCH;
        Severity: Major
        Found in src/adapter/AxiosRequestConfigAdapter.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return HTTP_METHOD.GET;
          Severity: Major
          Found in src/adapter/AxiosRequestConfigAdapter.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return HTTP_METHOD.HEAD;
            Severity: Major
            Found in src/adapter/AxiosRequestConfigAdapter.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return HTTP_METHOD.OPTIONS;
              Severity: Major
              Found in src/adapter/AxiosRequestConfigAdapter.ts - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language