balazsbotond/eslinq

View on GitHub

Showing 127 of 127 total issues

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

        it("returns undefined if `index` is greater than the length of the sequence and it is called without a default value", () => {
            expect(from(yieldFrom([1, 2, 3])).elementAtOrDefault(4)).toBeUndefined();
        });
Severity: Minor
Found in spec/elementAtOrDefault-spec.js and 1 other location - About 35 mins to fix
spec/elementAtOrDefault-spec.js on lines 71..73

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

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 _elementAt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    _elementAt(index) {
        const exhaustedResult = { element: undefined, exhausted: true },
            valueResult = v => { return { element: v, exhausted: false }; };

        // O(1) optimization for arrays
Severity: Minor
Found in src/eslinq.js - 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

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

    max(transform = identity, compare = compareDefault) {
        ensureIsFunction(transform, "`transform` should be a function");
        ensureIsFunction(compare, "`compare` should be a function");

        return this._findExtremum(
Severity: Minor
Found in src/eslinq.js and 1 other location - About 35 mins to fix
src/eslinq.js on lines 986..993

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

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

    min(transform = identity, compare = compareDefault) {
        ensureIsFunction(transform, "`transform` should be a function");
        ensureIsFunction(compare, "`compare` should be a function");

        return this._findExtremum(
Severity: Minor
Found in src/eslinq.js and 1 other location - About 35 mins to fix
src/eslinq.js on lines 1057..1064

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

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

    it("throws if it is called with a single non-function argument", () => {
        expect(() => from([1]).aggregate(1)).toThrowError("`processNext` should be a function");
    });
Severity: Minor
Found in spec/aggregate-spec.js and 2 other locations - About 30 mins to fix
spec/all-spec.js on lines 8..10
spec/any-spec.js on lines 8..10

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

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

    it("throws an error if `transform` is specified but not a function", () => {
        expect(() => from([]).toLookup(identity, 1))
            .toThrowError("`transform` should be a function");
    });
Severity: Minor
Found in spec/toLookup-spec.js and 2 other locations - About 30 mins to fix
spec/max-spec.js on lines 16..18
spec/min-spec.js on lines 16..18

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

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

        it("returns the default if `index` is equal to the length of the sequence and it is called with a default value", () => {
            expect(from([1, 2, 3]).elementAtOrDefault(3, 1)).toBe(1);
        });
Severity: Minor
Found in spec/elementAtOrDefault-spec.js and 1 other location - About 30 mins to fix
spec/elementAtOrDefault-spec.js on lines 37..39

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

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

    it("throws if it is called with a non-function argument", () => {
        expect(() => from([1]).any(0)).toThrowError("`matches` should be a function");
    });
Severity: Minor
Found in spec/any-spec.js and 2 other locations - About 30 mins to fix
spec/aggregate-spec.js on lines 11..13
spec/all-spec.js on lines 8..10

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

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

    it("throws if `compare` is not a function", () => {
        expect(() => from([]).max(identity, 1)).toThrowError("`compare` should be a function");
    });
Severity: Minor
Found in spec/max-spec.js and 2 other locations - About 30 mins to fix
spec/min-spec.js on lines 16..18
spec/toLookup-spec.js on lines 12..15

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

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

        it("returns the default if `index` is greater than the length of the sequence and it is called with a default value", () => {
            expect(from([1, 2, 3]).elementAtOrDefault(4, 1)).toBe(1);
        });
Severity: Minor
Found in spec/elementAtOrDefault-spec.js and 1 other location - About 30 mins to fix
spec/elementAtOrDefault-spec.js on lines 29..31

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

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

    it("throws if it is called with a non-function argument", () => {
        expect(() => from([1]).all(0)).toThrowError("`matches` should be a function");
    });
Severity: Minor
Found in spec/all-spec.js and 2 other locations - About 30 mins to fix
spec/aggregate-spec.js on lines 11..13
spec/any-spec.js on lines 8..10

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

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

    it("throws if `compare` is not a function", () => {
        expect(() => from([]).min(identity, 1)).toThrowError("`compare` should be a function");
    });
Severity: Minor
Found in spec/min-spec.js and 2 other locations - About 30 mins to fix
spec/max-spec.js on lines 16..18
spec/toLookup-spec.js on lines 12..15

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

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 _single has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _single(matches = constantTrue) {
        let found = false, item;

        for (let i of this.iterable) {
            if (matches(i)) {
Severity: Minor
Found in src/eslinq.js - 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

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
Open

import from from "../src/eslinq";
Severity: Minor
Found in spec/all-spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
Open

import { Sequence } from "../src/eslinq";
Severity: Minor
Found in spec/empty-spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
Open

import from from "../src/eslinq";
Severity: Minor
Found in spec/from-spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
Open

import from from "../src/eslinq";
Severity: Minor
Found in spec/sum-spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
Open

import from from "../src/eslinq";
Severity: Minor
Found in spec/min-spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
Open

import from from "../src/eslinq";
Severity: Minor
Found in spec/contains-spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
Open

import from from "../src/eslinq";
Severity: Minor
Found in spec/elementAt-spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Severity
Category
Status
Source
Language