Rescla/range-ts

View on GitHub

Showing 20 of 20 total issues

Function exports has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (config) {
  config.set({
    basePath: "../dist/karma",
    frameworks: ["jasmine"],
    files: ["test.js"],
Severity: Major
Found in src/karma.conf.js - About 2 hrs to fix

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        if (this.upperEndpointValue === other.upperEndpointValue) {
          upperBoundType =
            this.upperBoundType === BoundType.CLOSED ||
            other.upperBoundType === BoundType.CLOSED
              ? BoundType.CLOSED
    Severity: Major
    Found in src/number-range/number-range.ts and 3 other locations - About 2 hrs to fix
    src/number-range/number-range.ts on lines 171..179
    src/number-range/number-range.ts on lines 181..189
    src/number-range/number-range.ts on lines 234..242

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        if (this.lowerEndpointValue === other.lowerEndpointValue) {
          lowerBoundType =
            this.lowerBoundType === BoundType.CLOSED ||
            other.lowerBoundType === BoundType.CLOSED
              ? BoundType.CLOSED
    Severity: Major
    Found in src/number-range/number-range.ts and 3 other locations - About 2 hrs to fix
    src/number-range/number-range.ts on lines 171..179
    src/number-range/number-range.ts on lines 181..189
    src/number-range/number-range.ts on lines 244..252

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        if (this.lowerEndpointValue === other.lowerEndpointValue) {
          lowerBoundType =
            this.lowerBoundType === BoundType.OPEN ||
            other.lowerBoundType === BoundType.OPEN
              ? BoundType.OPEN
    Severity: Major
    Found in src/number-range/number-range.ts and 3 other locations - About 2 hrs to fix
    src/number-range/number-range.ts on lines 181..189
    src/number-range/number-range.ts on lines 234..242
    src/number-range/number-range.ts on lines 244..252

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        if (this.upperEndpointValue === other.upperEndpointValue) {
          upperBoundType =
            this.upperBoundType === BoundType.OPEN ||
            other.upperBoundType === BoundType.OPEN
              ? BoundType.OPEN
    Severity: Major
    Found in src/number-range/number-range.ts and 3 other locations - About 2 hrs to fix
    src/number-range/number-range.ts on lines 171..179
    src/number-range/number-range.ts on lines 234..242
    src/number-range/number-range.ts on lines 244..252

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        this.rangeValues
          .filter((range) => !range.range.isEmpty())
          .sort(
            (a, b) =>
              a.range.lowerEndpoint.valueOf() - b.range.lowerEndpoint.valueOf()
    Severity: Major
    Found in src/range-map/range-map.ts and 1 other location - About 2 hrs to fix
    src/range-map/range-map.ts on lines 66..78

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 82.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        this.rangeValues
          .filter((range) => !range.range.isEmpty())
          .sort(
            (a, b) =>
              a.range.lowerEndpoint.valueOf() - b.range.lowerEndpoint.valueOf()
    Severity: Major
    Found in src/range-map/range-map.ts and 1 other location - About 2 hrs to fix
    src/range-map/range-map.ts on lines 49..57

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 82.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function combinedPut has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private combinedPut(
        range: NumberRange,
        value: T,
        shouldPutCoalescing: boolean = false
      ): void {
    Severity: Major
    Found in src/range-map/range-map.ts - About 2 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          const upperEndpointEnclosed =
            other.upperBoundType === BoundType.OPEN
              ? this.contains(other.upperEndpoint) ||
                this.upperEndpointValue === other.upperEndpointValue
              : this.contains(other.upperEndpoint);
      Severity: Major
      Found in src/number-range/number-range.ts and 1 other location - About 1 hr to fix
      src/number-range/number-range.ts on lines 134..138

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 65.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          const lowerEndpointEnclosed =
            other.lowerBoundType === BoundType.OPEN
              ? this.contains(other.lowerEndpoint) ||
                this.lowerEndpointValue === other.lowerEndpointValue
              : this.contains(other.lowerEndpoint);
      Severity: Major
      Found in src/number-range/number-range.ts and 1 other location - About 1 hr to fix
      src/number-range/number-range.ts on lines 139..143

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 65.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function intersection has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        intersection(other: NumberRange): NumberRange | null {
          if (!this.isConnected(other)) {
            return null;
          }
      
      
      Severity: Minor
      Found in src/number-range/number-range.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 toString has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        toString(): string {
          const getLowerBoundCharacter = () => {
            switch (this.lowerBoundType) {
              case BoundType.OPEN:
                return "(";
      Severity: Minor
      Found in src/number-range/number-range.ts - About 1 hr to fix

        Function intersection has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          intersection(other: NumberRange): NumberRange | null {
            if (!this.isConnected(other)) {
              return null;
            }
        
        
        Severity: Minor
        Found in src/number-range/number-range.ts - About 1 hr to fix

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

            span(other: NumberRange): NumberRange {
              // Determine outer ranges
              const lowerRange = this.lowerEndpointValue <= other.lowerEndpointValue ? this : other;
              const upperRange = this.upperEndpointValue >= other.upperEndpointValue ? this : other;
          
          
          Severity: Minor
          Found in src/number-range/number-range.ts - About 1 hr to fix

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

              span(other: NumberRange): NumberRange {
                // Determine outer ranges
                const lowerRange = this.lowerEndpointValue <= other.lowerEndpointValue ? this : other;
                const upperRange = this.upperEndpointValue >= other.upperEndpointValue ? this : other;
            
            
            Severity: Minor
            Found in src/number-range/number-range.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 toString has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              toString(): string {
                const getLowerBoundCharacter = () => {
                  switch (this.lowerBoundType) {
                    case BoundType.OPEN:
                      return "(";
            Severity: Minor
            Found in src/number-range/number-range.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

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              static closed(lower: Comparable, upper: Comparable): NumberRange {
                return new NumberRange(lower, BoundType.CLOSED, upper, BoundType.CLOSED);
              }
            Severity: Major
            Found in src/number-range/number-range.ts and 3 other locations - About 45 mins to fix
            src/number-range/number-range.ts on lines 29..31
            src/number-range/number-range.ts on lines 43..45
            src/number-range/number-range.ts on lines 50..52

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 50.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              static open(lower: Comparable, upper: Comparable): NumberRange {
                return new NumberRange(lower, BoundType.OPEN, upper, BoundType.OPEN);
              }
            Severity: Major
            Found in src/number-range/number-range.ts and 3 other locations - About 45 mins to fix
            src/number-range/number-range.ts on lines 29..31
            src/number-range/number-range.ts on lines 36..38
            src/number-range/number-range.ts on lines 50..52

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 50.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              static closedOpen(lower: Comparable, upper: Comparable): NumberRange {
                return new NumberRange(lower, BoundType.CLOSED, upper, BoundType.OPEN);
              }
            Severity: Major
            Found in src/number-range/number-range.ts and 3 other locations - About 45 mins to fix
            src/number-range/number-range.ts on lines 36..38
            src/number-range/number-range.ts on lines 43..45
            src/number-range/number-range.ts on lines 50..52

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 50.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              static openClosed(lower: Comparable, upper: Comparable): NumberRange {
                return new NumberRange(lower, BoundType.OPEN, upper, BoundType.CLOSED);
              }
            Severity: Major
            Found in src/number-range/number-range.ts and 3 other locations - About 45 mins to fix
            src/number-range/number-range.ts on lines 29..31
            src/number-range/number-range.ts on lines 36..38
            src/number-range/number-range.ts on lines 43..45

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 50.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language