Linqable/lib

View on GitHub
src/Base/behaviour.ts

Summary

Maintainability
D
2 days
Test Coverage

Function strCompare has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

    public static strCompare(a: string, b: string): number {
        var ia = 0;
        var ib = 0;
        var ma = a.length;
        var mb = b.length;
Severity: Minor
Found in src/Base/behaviour.ts - About 7 hrs 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 strCompare has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static strCompare(a: string, b: string): number {
        var ia = 0;
        var ib = 0;
        var ma = a.length;
        var mb = b.length;
Severity: Major
Found in src/Base/behaviour.ts - About 2 hrs to fix

    Function SortComparer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected SortComparer(a: any, b: any): number {
            if (a === b) return 0;
            if (a === null || a === undefined) return -1;
            if (b === null || b === undefined) return 1;
            if (a.hasOwnProperty("Compare"))
    Severity: Minor
    Found in src/Base/behaviour.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 EqualityComparer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        protected EqualityComparer(a: any, b: any): boolean {
            if (a === b) return true;
            if (a === null || a === undefined) return false;
            if (b === null || b === undefined) return false;
            if (typeof a == 'string')
    Severity: Minor
    Found in src/Base/behaviour.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

    Avoid too many return statements within this function.
    Open

                if (ca > cb) return 1;
    Severity: Major
    Found in src/Base/behaviour.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              if (ma < mb) return -1;
      Severity: Major
      Found in src/Base/behaviour.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return true;
        Severity: Major
        Found in src/Base/behaviour.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      if (za > zb) return -1;
          Severity: Major
          Found in src/Base/behaviour.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return -1;
            Severity: Major
            Found in src/Base/behaviour.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return Behaviour.strCompare(a, b);
              Severity: Major
              Found in src/Base/behaviour.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return a.valueOf() === b.valueOf();
                Severity: Major
                Found in src/Base/behaviour.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return 0;
                  Severity: Major
                  Found in src/Base/behaviour.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                if (za < zb) return 1;
                    Severity: Major
                    Found in src/Base/behaviour.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              if (ma > mb) return 1;
                      Severity: Major
                      Found in src/Base/behaviour.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return a.valueOf() - b.valueOf();
                        Severity: Major
                        Found in src/Base/behaviour.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      if (bias) return bias;
                          Severity: Major
                          Found in src/Base/behaviour.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        if (ca < cb) return -1;
                            Severity: Major
                            Found in src/Base/behaviour.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return 1;
                              Severity: Major
                              Found in src/Base/behaviour.ts - About 30 mins to fix

                                There are no issues that match your filters.

                                Category
                                Status