NodeRedis/node-redis

View on GitHub
packages/search/lib/commands/CREATE.spec.ts

Summary

Maintainability
F
3 days
Test Coverage

File CREATE.spec.ts has 381 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CREATE';
import { SchemaFieldTypes, SchemaTextFieldPhonetics, RedisSearchLanguages, VectorAlgorithms } from '.';

Severity: Minor
Found in packages/search/lib/commands/CREATE.spec.ts - About 5 hrs to fix

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

            describe('with STOPWORDS', () => {
                it('string', () => {
                    assert.deepEqual(
                        transformArguments('index', {}, {
                            STOPWORDS: 'stopword'
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 1 other location - About 3 hrs to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 261..279

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

    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

            describe('with PREFIX', () => {
                it('string', () => {
                    assert.deepEqual(
                        transformArguments('index', {}, {
                            PREFIX: 'prefix'
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 1 other location - About 3 hrs to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 389..407

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

    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('UNF', () => {
                            assert.deepEqual(
                                transformArguments('index', {
                                    field: {
                                        type: SchemaFieldTypes.TEXT,
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 2 other locations - About 1 hr to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 116..126
    packages/search/lib/commands/CREATE.spec.ts on lines 200..210

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

    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('with SEPARATOR', () => {
                        assert.deepEqual(
                            transformArguments('index', {
                                field: {
                                    type: SchemaFieldTypes.TAG,
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 2 other locations - About 1 hr to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 200..210
    packages/search/lib/commands/CREATE.spec.ts on lines 225..235

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

    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('with AS', () => {
                        assert.deepEqual(
                            transformArguments('index', {
                                field: {
                                    type: SchemaFieldTypes.TEXT,
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 2 other locations - About 1 hr to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 116..126
    packages/search/lib/commands/CREATE.spec.ts on lines 225..235

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

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

                        it('true', () => {
                            assert.deepEqual(
                                transformArguments('index', {
                                    field: {
                                        type: SchemaFieldTypes.TEXT,
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 5 other locations - About 1 hr to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 26..36
    packages/search/lib/commands/CREATE.spec.ts on lines 62..72
    packages/search/lib/commands/CREATE.spec.ts on lines 128..138
    packages/search/lib/commands/CREATE.spec.ts on lines 140..150
    packages/search/lib/commands/CREATE.spec.ts on lines 238..248

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

                    it('with NOINDEX', () => {
                        assert.deepEqual(
                            transformArguments('index', {
                                field: {
                                    type: SchemaFieldTypes.TEXT,
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 5 other locations - About 1 hr to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 26..36
    packages/search/lib/commands/CREATE.spec.ts on lines 62..72
    packages/search/lib/commands/CREATE.spec.ts on lines 128..138
    packages/search/lib/commands/CREATE.spec.ts on lines 140..150
    packages/search/lib/commands/CREATE.spec.ts on lines 213..223

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

                    it('with NOSTEM', () => {
                        assert.deepEqual(
                            transformArguments('index', {
                                field: {
                                    type: SchemaFieldTypes.TEXT,
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 5 other locations - About 1 hr to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 62..72
    packages/search/lib/commands/CREATE.spec.ts on lines 128..138
    packages/search/lib/commands/CREATE.spec.ts on lines 140..150
    packages/search/lib/commands/CREATE.spec.ts on lines 213..223
    packages/search/lib/commands/CREATE.spec.ts on lines 238..248

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

                    it('with CASESENSITIVE', () => {
                        assert.deepEqual(
                            transformArguments('index', {
                                field: {
                                    type: SchemaFieldTypes.TAG,
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 5 other locations - About 1 hr to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 26..36
    packages/search/lib/commands/CREATE.spec.ts on lines 62..72
    packages/search/lib/commands/CREATE.spec.ts on lines 140..150
    packages/search/lib/commands/CREATE.spec.ts on lines 213..223
    packages/search/lib/commands/CREATE.spec.ts on lines 238..248

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

                    it('with WITHSUFFIXTRIE', () => {
                        assert.deepEqual(
                            transformArguments('index', {
                                field: {
                                    type: SchemaFieldTypes.TEXT,
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 5 other locations - About 1 hr to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 26..36
    packages/search/lib/commands/CREATE.spec.ts on lines 128..138
    packages/search/lib/commands/CREATE.spec.ts on lines 140..150
    packages/search/lib/commands/CREATE.spec.ts on lines 213..223
    packages/search/lib/commands/CREATE.spec.ts on lines 238..248

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

                    it('with WITHSUFFIXTRIE', () => {
                        assert.deepEqual(
                            transformArguments('index', {
                                field: {
                                    type: SchemaFieldTypes.TAG,
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 5 other locations - About 1 hr to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 26..36
    packages/search/lib/commands/CREATE.spec.ts on lines 62..72
    packages/search/lib/commands/CREATE.spec.ts on lines 128..138
    packages/search/lib/commands/CREATE.spec.ts on lines 213..223
    packages/search/lib/commands/CREATE.spec.ts on lines 238..248

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

                        it('SchemaFieldTypes.TAG', () => {
                            assert.deepEqual(
                                transformArguments('index', {
                                    field: SchemaFieldTypes.TAG
                                }),
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 3 other locations - About 35 mins to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 17..24
    packages/search/lib/commands/CREATE.spec.ts on lines 75..82
    packages/search/lib/commands/CREATE.spec.ts on lines 84..91

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

                it('GEO', () => {
                    assert.deepEqual(
                        transformArguments('index', {
                            field: SchemaFieldTypes.GEO
                        }),
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 3 other locations - About 35 mins to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 17..24
    packages/search/lib/commands/CREATE.spec.ts on lines 75..82
    packages/search/lib/commands/CREATE.spec.ts on lines 95..102

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

                it('NUMERIC', () => {
                    assert.deepEqual(
                        transformArguments('index', {
                            field: SchemaFieldTypes.NUMERIC
                        }),
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 3 other locations - About 35 mins to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 17..24
    packages/search/lib/commands/CREATE.spec.ts on lines 84..91
    packages/search/lib/commands/CREATE.spec.ts on lines 95..102

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

                    it('without options', () => {
                        assert.deepEqual(
                            transformArguments('index', {
                                field: SchemaFieldTypes.TEXT
                            }),
    Severity: Major
    Found in packages/search/lib/commands/CREATE.spec.ts and 3 other locations - About 35 mins to fix
    packages/search/lib/commands/CREATE.spec.ts on lines 75..82
    packages/search/lib/commands/CREATE.spec.ts on lines 84..91
    packages/search/lib/commands/CREATE.spec.ts on lines 95..102

    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

    There are no issues that match your filters.

    Category
    Status