averias/redis-time-series

View on GitHub
src/__tests__/unit/builder/requestParamsDirector.test.ts

Summary

Maintainability
A
1 hr
Test Coverage

File requestParamsDirector.test.ts has 316 lines of code (exceeds 250 allowed). Consider refactoring.
Invalid

import { RequestParamsDirector } from "../../../builder/requestParamsDirector";
import { Label } from "../../../entity/label";
import { AggregationType } from "../../../enum/aggregationType";
import { CommandKeyword } from "../../../enum/commandKeyword";
import { Sample } from "../../../entity/sample";
Severity: Minor
Found in src/__tests__/unit/builder/requestParamsDirector.test.ts - About 3 hrs to fix

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

    test("create with labels and retention", () => {
        expect(director.create("key", [label1, label2], 10000).get()).toEqual([
            "key",
            CommandKeyword.RETENTION,
            10000,
    Severity: Major
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 1 other location - About 2 hrs to fix
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 72..83

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

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

    test("alter with labels and retention", () => {
        expect(director.alter("key", [label1, label2], 10000).get()).toEqual([
            "key",
            CommandKeyword.RETENTION,
            10000,
    Severity: Major
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 1 other location - About 2 hrs to fix
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 36..47

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

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

    test("alter without retention", () => {
        expect(director.alter("key", [label1, label2]).get()).toEqual([
            "key",
            CommandKeyword.LABELS,
            label1.getName(),
    Severity: Major
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 1 other location - About 2 hrs to fix
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 49..58

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

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

    test("create without retention", () => {
        expect(director.create("key", [label1, label2]).get()).toEqual([
            "key",
            CommandKeyword.LABELS,
            label1.getName(),
    Severity: Major
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 1 other location - About 2 hrs to fix
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 85..94

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

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

    test("alter without labels", () => {
        expect(director.alter("key", undefined, 10000).get()).toEqual(["key", CommandKeyword.RETENTION, 10000]);
    });
    Severity: Minor
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 1 other location - About 55 mins to fix
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 60..62

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

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

    test("create without labels", () => {
        expect(director.create("key", undefined, 10000).get()).toEqual(["key", CommandKeyword.RETENTION, 10000]);
    });
    Severity: Minor
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 1 other location - About 55 mins to fix
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 96..98

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

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

    test("multiadd with empty labels", () => {
        expect(director.multiAdd([]).get().length).toEqual(0);
    });
    Severity: Minor
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 2 other locations - About 40 mins to fix
    src/__tests__/unit/builder/requestParamsBuilder.test.ts on lines 53..55
    src/__tests__/unit/builder/requestParamsBuilder.test.ts 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 48.

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

    test("delete rule", () => {
        expect(director.deleteRule("source", "destination").get()).toEqual(["source", "destination"]);
    });
    Severity: Minor
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 1 other location - About 35 mins to fix
    src/__tests__/unit/builder/requestParamsBuilder.test.ts on lines 24..26

    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

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

    test("alter default", () => {
        expect(director.alter("key").get()).toEqual(["key"]);
    });
    Severity: Major
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 3 other locations - About 30 mins to fix
    src/__tests__/unit/builder/requestParamsBuilder.test.ts on lines 20..22
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 68..70
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 346..348

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

    test("create default", () => {
        expect(director.create("key").get()).toEqual(["key"]);
    });
    Severity: Major
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 3 other locations - About 30 mins to fix
    src/__tests__/unit/builder/requestParamsBuilder.test.ts on lines 20..22
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 109..111
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 346..348

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

    test("get key", () => {
        expect(director.getKey("key").get()).toEqual(["key"]);
    });
    Severity: Major
    Found in src/__tests__/unit/builder/requestParamsDirector.test.ts and 3 other locations - About 30 mins to fix
    src/__tests__/unit/builder/requestParamsBuilder.test.ts on lines 20..22
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 68..70
    src/__tests__/unit/builder/requestParamsDirector.test.ts on lines 109..111

    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

    There are no issues that match your filters.

    Category
    Status