superdesk/superdesk-client-core

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

Summary

Maintainability
F
3 days
Test Coverage

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

    constructor() {
        this.list = element.all(by.repeater('config in configurations._items'));
        this.name = element(by.model('configEdit.name'));
        this.desks = element.all(by.repeater('desk in assignedDesks'));
        this.groups = element.all(by.repeater('group in configEdit.groups'));
Severity: Major
Found in e2e/client/specs/helpers/highlights.ts - About 6 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/highlights.ts and 1 other location - About 4 hrs to fix
    e2e/client/specs/helpers/dictionaries.ts on lines 64..71

    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/highlights.ts and 2 other locations - About 3 hrs to fix
    e2e/client/specs/helpers/dictionaries.ts on lines 56..62
    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('config.name'))
                        .getText()
                        .then((text) => text.toUpperCase() === name.toUpperCase()),
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 4 other locations - About 2 hrs to fix
    e2e/client/specs/helpers/dictionaries.ts on lines 40..46
    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 5 locations. Consider refactoring.
    Open

            this.getGroup = function(name) {
                return this.groups.filter((elem, index) =>
                    elem.element(by.binding('group'))
                        .getText()
                        .then((text) => text.toUpperCase() === name.toUpperCase()),
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 4 other locations - About 2 hrs to fix
    e2e/client/specs/helpers/dictionaries.ts on lines 40..46
    e2e/client/specs/helpers/highlights.ts on lines 56..62
    e2e/client/specs/helpers/highlights.ts on lines 103..109
    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 5 locations. Consider refactoring.
    Open

            this.getDesk = function(name) {
                return this.desks.filter((elem, index) =>
                    elem.element(by.binding('desk.name'))
                        .getText()
                        .then((text) => text.toUpperCase() === name.toUpperCase()),
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 4 other locations - About 2 hrs to fix
    e2e/client/specs/helpers/dictionaries.ts on lines 40..46
    e2e/client/specs/helpers/highlights.ts on lines 56..62
    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.exportHighlightsConfirm = function() {
                var btn = element(by.className('modal__footer')).element(by.buttonText('OK'));
    
                waitFor(btn, 500);
                btn.click();
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 1 other location - About 1 hr to fix
    e2e/client/specs/helpers/highlights.ts on lines 229..234

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

    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.saveTextHighlightsConfirm = function() {
                var btn = element(by.className('modal__footer')).element(by.buttonText('Save'));
    
                waitFor(btn, 500);
                btn.click();
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 1 other location - About 1 hr to fix
    e2e/client/specs/helpers/highlights.ts on lines 222..227

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

    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.selectDesk = function(elem, name) {
                elem.all(by.className('dropdown__menu--submenu-left')).all(by.partialButtonText(name)).click();
            };
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 1 other location - About 1 hr to fix
    e2e/client/specs/helpers/highlights.ts on lines 199..201

    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

            this.selectHighlight = function(elem, name) {
                elem.all(by.repeater('h in highlights')).all(by.partialButtonText(name)).click();
            };
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 1 other location - About 1 hr to fix
    e2e/client/specs/helpers/highlights.ts on lines 203..205

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

                this.getGroup(name).then((groups) => {
                    groups[0].element(by.css('[ng-click="removeGroup(group)"]')).click();
                });
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 2 other locations - About 1 hr to fix
    e2e/client/specs/helpers/highlights.ts on lines 112..114
    e2e/client/specs/helpers/highlights.ts on lines 143..145

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

    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.getDesk(name).then((desks) => {
                    desks[0].element(by.className('sd-checkbox')).click();
                });
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 2 other locations - About 1 hr to fix
    e2e/client/specs/helpers/highlights.ts on lines 143..145
    e2e/client/specs/helpers/highlights.ts on lines 153..155

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

    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.getGroup(name).then((groups) => {
                    groups[0].element(by.css('[ng-click="editGroup(group)"]')).click();
                });
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 2 other locations - About 1 hr to fix
    e2e/client/specs/helpers/highlights.ts on lines 112..114
    e2e/client/specs/helpers/highlights.ts on lines 153..155

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

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

            this.add = function() {
                element(by.className('icon-plus-sign')).click();
                browser.sleep(500);
            };
    Severity: Major
    Found in e2e/client/specs/helpers/highlights.ts and 7 other locations - About 40 mins to fix
    e2e/client/specs/helpers/monitoring.ts on lines 554..557
    e2e/client/specs/helpers/monitoring.ts on lines 559..562
    e2e/client/specs/helpers/monitoring.ts on lines 564..567
    e2e/client/specs/helpers/monitoring.ts on lines 569..572
    e2e/client/specs/helpers/monitoring.ts on lines 574..577
    e2e/client/specs/helpers/monitoring.ts on lines 579..582
    e2e/client/specs/helpers/monitoring.ts on lines 716..719

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

    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/highlights.ts and 2 other locations - About 35 mins to fix
    e2e/client/specs/helpers/dictionaries.ts on lines 77..80
    e2e/client/specs/helpers/dictionaries.ts on lines 82..85

    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