superdesk/superdesk-client-core

View on GitHub
e2e/client/specs/helpers/dictionaries.ts

Summary

Maintainability
D
2 days
Test Coverage

Function constructor has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    constructor() {
        this.list = element.all(by.repeater('dictionary in dictionaries'));
        this.name = element(by.model('dictionary.name'));
        this.languageId = element(by.model('dictionary.language_id'));

Severity: Major
Found in e2e/client/specs/helpers/dictionaries.ts - About 3 hrs to fix

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

            this.remove = function(name) {
                this.getRow(name).then((rows) => {
                    rows[0].click();
                    rows[0].element(by.className('icon-trash')).click();
                    browser.sleep(500);
    Severity: Major
    Found in e2e/client/specs/helpers/dictionaries.ts and 1 other location - About 4 hrs to fix
    e2e/client/specs/helpers/highlights.ts on lines 81..88

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

    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

            this.edit = function(name) {
                this.getRow(name).then((rows) => {
                    rows[0].click();
                    rows[0].element(by.className('icon-pencil')).click();
                    browser.sleep(500);
    Severity: Major
    Found in e2e/client/specs/helpers/dictionaries.ts and 2 other locations - About 3 hrs to fix
    e2e/client/specs/helpers/highlights.ts on lines 73..79
    e2e/client/specs/helpers/subscribers.ts on lines 40..46

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

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

            this.getRow = function(name) {
                return this.list.filter((elem, index) =>
                    elem.element(by.binding('dictionary.name'))
                        .getText()
                        .then((text) => text.toUpperCase() === name.toUpperCase()),
    Severity: Major
    Found in e2e/client/specs/helpers/dictionaries.ts and 4 other locations - About 2 hrs to fix
    e2e/client/specs/helpers/highlights.ts on lines 56..62
    e2e/client/specs/helpers/highlights.ts on lines 103..109
    e2e/client/specs/helpers/highlights.ts on lines 127..133
    e2e/client/specs/helpers/subscribers.ts on lines 28..34

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

    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

            this.addPersonalDictionary = function() {
                element(by.css('[data-sd-tooltip="Add new"]')).click();
                element(by.id('createPersonalDictionary')).click();
                browser.sleep(100);
            };
    Severity: Major
    Found in e2e/client/specs/helpers/dictionaries.ts and 1 other location - About 1 hr to fix
    e2e/client/specs/helpers/dictionaries.ts on lines 87..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 71.

    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

            this.addDictionary = function() {
                element(by.css('[data-sd-tooltip="Add new"]')).click();
                element(by.id('createDictionary')).click();
                browser.sleep(100);
            };
    Severity: Major
    Found in e2e/client/specs/helpers/dictionaries.ts and 1 other location - About 1 hr to fix
    e2e/client/specs/helpers/dictionaries.ts on lines 93..97

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

    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

            this.setLanguageId = function(languageId) {
                this.languageId.clear();
                this.languageId.sendKeys(languageId);
            };
    Severity: Minor
    Found in e2e/client/specs/helpers/dictionaries.ts and 2 other locations - About 35 mins to fix
    e2e/client/specs/helpers/dictionaries.ts on lines 77..80
    e2e/client/specs/helpers/highlights.ts on lines 94..97

    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

            this.setName = function(name) {
                this.name.clear();
                this.name.sendKeys(name);
            };
    Severity: Minor
    Found in e2e/client/specs/helpers/dictionaries.ts and 2 other locations - About 35 mins to fix
    e2e/client/specs/helpers/dictionaries.ts on lines 82..85
    e2e/client/specs/helpers/highlights.ts on lines 94..97

    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