ossplz/alsatian-fluent-assertions

View on GitHub

Showing 15 of 53 total issues

File simple-matcher.ts has 358 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import deepEqual = require("deep-equal");
import { MatchError } from "alsatian";

import { SpecError } from "../errors";
import { ISimpleMatcher } from "./i-simple-matcher";
Severity: Minor
Found in src/matchers/simple-matcher.ts - About 4 hrs to fix

    File elements-matcher.ts has 332 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { IPropertiesMatcher } from "./i-properties-matcher";
    import { MatchMode, LocationMode, EqType, AssertionContext } from "../types";
    import { IFluentCore } from "./i-fluent-core";
    import { IElementsMatcher } from "./i-elements-matcher";
    import { INarrowableFluentCore } from "./i-narrowable-fluent-core";
    Severity: Minor
    Found in src/matchers/elements-matcher.ts - About 4 hrs to fix

      SimpleMatcher has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class SimpleMatcher<T, TNext, TPrev> extends Operators<T, TNext, TPrev>
        implements ISimpleMatcher<T, TNext, TPrev> {
          constructor(actualValue: any,
            nextValue: any,
            initial: boolean,
      Severity: Minor
      Found in src/matchers/simple-matcher.ts - About 3 hrs to fix

        Function _assertSequentialHasElements has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          protected _assertSequentialHasElements(
            expected: Array<any>,
            location: LocationMode,
            elMode: MatchMode,
            path: Array<string>
        Severity: Minor
        Found in src/matchers/elements-matcher.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 _assertSequentialHasElements has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          protected _assertSequentialHasElements(
            expected: Array<any>,
            location: LocationMode,
            elMode: MatchMode,
            path: Array<string>
        Severity: Minor
        Found in src/matchers/elements-matcher.ts - About 1 hr to fix

          Function _heuristicMatch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            protected _heuristicMatch(
              actual: any,
              expected: any,
              location: LocationMode,
              elMode: MatchMode.asserts | MatchMode.normal
          Severity: Minor
          Found in src/matchers/elements-matcher.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 hasProperty has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public hasProperty<R>(
              expected: ((o: T) => R) | keyof T
            ): INarrowableFluentCore<T, R, TPrev>
            {
              this.setCurrentNode(this.hasProperty.name, null);
          Severity: Minor
          Found in src/matchers/simple-matcher.ts - About 1 hr to fix

            Function isEmpty has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public isEmpty(): IFluentCore<T, TNext, TPrev> {
                this.setCurrentNode(this.isEmpty.name, null);
                if (
                  !(
                    typeof this.actualValue === "object" ||
            Severity: Minor
            Found in src/matchers/simple-matcher.ts - About 1 hr to fix

              Function _assertHasElements has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                protected _assertHasElements(
                  actual: Array<any>,
                  expected: Array<any>,
                  location: LocationMode,
                  elMode: MatchMode,
              Severity: Minor
              Found in src/matchers/elements-matcher.ts - About 45 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 _assertContainsElements has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                protected _assertContainsElements(
                  expected: Array<any>,
                  location: LocationMode,
                  elMode: MatchMode,
                  path: Array<string>
              Severity: Minor
              Found in src/matchers/elements-matcher.ts - About 45 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 hasProperty has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                public hasProperty<R>(
                  expected: ((o: T) => R) | keyof T
                ): INarrowableFluentCore<T, R, TPrev>
                {
                  this.setCurrentNode(this.hasProperty.name, null);
              Severity: Minor
              Found in src/matchers/simple-matcher.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

              Avoid too many return statements within this function.
              Open

                      return expected(actual);
              Severity: Major
              Found in src/matchers/elements-matcher.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return false;
                Severity: Major
                Found in src/matchers/elements-matcher.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return this._deeplyEquals(actual, expected, EqType.strictly);
                  Severity: Major
                  Found in src/matchers/elements-matcher.ts - About 30 mins to fix

                    Function _assertThrew has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      protected _assertThrew<TError extends Error>(
                        threw: Error,
                        errorType: {
                          new (...args: Array<any>): TError;
                        }
                    Severity: Minor
                    Found in src/matchers/simple-matcher.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