Linqable/lib

View on GitHub
src/AdvancedLinqable.ts

Summary

Maintainability
C
1 day
Test Coverage

Function Transpose has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public Transpose<T>(): Array<Array<T>> {
        if (!this.array) throw new ArgumentNullError("array");
        var source: Array<Array<T>> = this.array as any;
        let generator = function* (): IterableIterator<Array<T>> {
            var enumerators =
Severity: Minor
Found in src/AdvancedLinqable.ts - About 2 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 Batch has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public Batch(size: number, resultSelector?: (arr: Array<T>) => Array<T>): Array<T[]> {
        let source = this.array;
        resultSelector = resultSelector || ((arr: Array<T>) => arr);
        let generator = function* (): IterableIterator<Array<T>> {
            let bucket: T[] = null;
Severity: Minor
Found in src/AdvancedLinqable.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 Flatten has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public Flatten(predicate?: (arr: Array<{}>) => boolean) {
        this.checkArray();
        predicate = predicate || ((x) => typeof x !== "string");
        let that = this;
        let generator = function* () {
Severity: Minor
Found in src/AdvancedLinqable.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 Flatten has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public Flatten(predicate?: (arr: Array<{}>) => boolean) {
        this.checkArray();
        predicate = predicate || ((x) => typeof x !== "string");
        let that = this;
        let generator = function* () {
Severity: Minor
Found in src/AdvancedLinqable.ts - About 1 hr to fix

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

        public Transpose<T>(): Array<Array<T>> {
            if (!this.array) throw new ArgumentNullError("array");
            var source: Array<Array<T>> = this.array as any;
            let generator = function* (): IterableIterator<Array<T>> {
                var enumerators =
    Severity: Minor
    Found in src/AdvancedLinqable.ts - About 1 hr to fix

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

          public Lag<TResult>(offset: number, defaultValue: T, selector: (x: T, y: T) => TResult): TResult[] {
              this.checkArray();
              if (!selector) throw new ArgumentNullError("Selector is undefined.");
              if (offset <= 0) throw new ArgumentOutOfRangeError("offset <= 0");
              let that = this;
      Severity: Minor
      Found in src/AdvancedLinqable.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

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

          public Exclude(startIndex: number, count: number): T[] {
              this.checkArray();
              if (startIndex < 0) throw new ArgumentOutOfRangeError("startIndex is negative.");
              if (count < 0) throw new ArgumentOutOfRangeError("count is negative.");
              if (count == 0) return this.array;
      Severity: Minor
      Found in src/AdvancedLinqable.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

      There are no issues that match your filters.

      Category
      Status