Codibre/fluent-iterable-js-sdsl

View on GitHub

Showing 33 of 33 total issues

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

        toDeque<K = T>(
            value?: Mapper<T, K> | AsyncMapper<T, K>,
            reverse?: boolean,
        ): Promise<IterableDeque<K>>;
Severity: Major
Found in src/deque-declaration.ts and 1 other location - About 1 hr to fix
src/deque-declaration.ts on lines 22..25

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

        toDequeAsync<K = T>(
            value?: Mapper<T, K> | AsyncMapper<T, K>,
            reverse?: boolean,
        ): Promise<IterableDeque<K>>;
Severity: Major
Found in src/deque-declaration.ts and 1 other location - About 1 hr to fix
src/deque-declaration.ts on lines 34..37

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

export class IterableQueue<K> extends Queue<K> {
    *[Symbol.iterator]() {
        while (this.length > 0) {
            yield this.pop();
        }
Severity: Major
Found in src/queue/iterable-queue.ts and 1 other location - About 1 hr to fix
src/stack/iterable-stack.ts on lines 3..9

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 60.

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

export class IterableStack<K> extends Stack<K> {
    *[Symbol.iterator]() {
        while (this.length > 0) {
            yield this.pop();
        }
Severity: Major
Found in src/stack/iterable-stack.ts and 1 other location - About 1 hr to fix
src/queue/iterable-queue.ts on lines 3..9

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 60.

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

        toPriorityQueueAsync<K extends keyof T>(
            value: K,
            comparer?: Comparer<K>,
        ): Promise<IterablePriorityQueue<T[K]>>;
Severity: Major
Found in src/priority-queue-declaration.ts and 1 other location - About 1 hr to fix
src/priority-queue-declaration.ts on lines 38..41

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 58.

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

        toPriorityQueue<K extends keyof T>(
            value: K,
            comparer?: Comparer<K>,
        ): Promise<IterablePriorityQueue<T[K]>>;
Severity: Major
Found in src/priority-queue-declaration.ts and 1 other location - About 1 hr to fix
src/priority-queue-declaration.ts on lines 27..30

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 58.

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

        toDeque<K extends keyof T>(
            value: K,
            reverse?: boolean,
        ): Promise<IterableDeque<T[K]>>;
Severity: Minor
Found in src/deque-declaration.ts and 1 other location - About 45 mins to fix
src/deque-declaration.ts on lines 26..29

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 2 locations. Consider refactoring.
Open

        toDequeAsync<K extends keyof T>(
            value: K,
            reverse?: boolean,
        ): Promise<IterableDeque<T[K]>>;
Severity: Minor
Found in src/deque-declaration.ts and 1 other location - About 45 mins to fix
src/deque-declaration.ts on lines 38..41

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

Function toOrderedMap has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    this: Iterable<T>,
    key: Mapping<T>,
    value: Mapping<T> | undefined,
    cmp: Comparer<unknown> | undefined,
    reducer: Reducer<unknown, unknown> | undefined,
Severity: Minor
Found in src/ordered-map/to-ordered-map.ts - About 35 mins to fix

    Function toOrderedMapAsync has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        this: Iterable<T> | AsyncIterable<T>,
        key: Mapping<T>,
        value: Mapping<T> | undefined,
        reducer: Reducer<unknown, unknown> | undefined,
        cmp: Comparer<unknown>,
    Severity: Minor
    Found in src/ordered-map/to-ordered-map-async.ts - About 35 mins to fix

      Function iterateSection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          *iterateSection(min: K, max: K, closedMin = true, closedMax = true) {
              const iterator =
                  this[closedMin ? 'reverseUpperBound' : 'reverseLowerBound'](min);
      
              while (!iterator.equals(this.treeEnd)) {
      Severity: Minor
      Found in src/ordered-set/binary-search-tree-set.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

      Function iterateSection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          *iterateSection(min: K, max: K, closedMin = true, closedMax = true) {
              const iterator =
                  this[closedMin ? 'reverseUpperBound' : 'reverseLowerBound'](min);
      
              while (!iterator.equals(this.treeEnd)) {
      Severity: Minor
      Found in src/ordered-map/binary-search-tree.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

      Function defaultComparer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export function defaultComparer(a: unknown, b: unknown) {
          const aType = typeof a;
          const bType = typeof b;
          if (aType === bType) {
              switch (aType) {
      Severity: Minor
      Found in src/utils/comparers.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

      Severity
      Category
      Status
      Source
      Language