superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

        this.setDeskType = function(deskType) {
            element(by.model('desk.edit.desk_type')).$('[value="' + deskType + '"]').click();
        };
Severity: Major
Found in e2e/client/specs/helpers/desks.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/templates.ts on lines 92..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 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 2 locations. Consider refactoring.
Open

            if (items.length !== 1) {
                // this block should never run, but I'm handling it anyway just in case

                const error = gettext('Publishing multiple items from authoring pane is not supported');

Severity: Major
Found in scripts/core/interactive-article-actions-panel/index-ui.tsx and 1 other location - About 1 hr to fix
scripts/core/interactive-article-actions-panel/index-ui.tsx on lines 154..164

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

        this.getSubjectFilteredTerm = function(index) {
            return this.subject.all(by.repeater('t in $vs_collection track by t[uniqueField]')).get(index).getText();
        };
Severity: Major
Found in e2e/client/specs/helpers/search.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/search.ts on lines 310..312

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

export function commandKey(key) {
    var Key = protractor.Key;

    browser.actions().sendKeys(Key.chord(Key.COMMAND, key))
        .perform();
Severity: Major
Found in e2e/client/specs/helpers/utils.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/utils.ts on lines 172..177

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

        this.getHeadline = function(rowNo) {
            var row = this.getRow(rowNo);

            return row.all(by.className('ng-binding')).get(2);
        };
Severity: Major
Found in e2e/client/specs/helpers/publish_queue.ts and 2 other locations - About 1 hr to fix
e2e/client/specs/helpers/publish_queue.ts on lines 36..40
e2e/client/specs/helpers/publish_queue.ts on lines 42..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 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 2 locations. Consider refactoring.
Open

        this.toggleScheduledDeskOutput = function(desk) {
            this.getDesk(desk).all(by.model('editGroups[desk._id + output.id].selected')).get(0).click();
        };
Severity: Major
Found in e2e/client/specs/helpers/monitoring.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/monitoring.ts on lines 641..643

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

        this.markForHighlights = function() {
            openAuthoringDropdown();
            browser.actions().mouseMove(element(by.css('.highlights-toggle .dropdown__toggle'))).perform();
        };
Severity: Major
Found in e2e/client/specs/helpers/authoring.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/authoring.ts on lines 647..650

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

        this.setTemplateType = function(templateType) {
            element(by.model('template.template_type')).$('[value="' + templateType + '"]').click();
        };
Severity: Major
Found in e2e/client/specs/helpers/templates.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/desks.ts on lines 273..275

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

            if (items.length !== 1) {
                // this block should never run, but I'm handling it anyway just in case

                const error = gettext('Correcting multiple items from authoring pane is not supported');

Severity: Major
Found in scripts/core/interactive-article-actions-panel/index-ui.tsx and 1 other location - About 1 hr to fix
scripts/core/interactive-article-actions-panel/index-ui.tsx on lines 121..131

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

export function altKey(key) {
    var Key = protractor.Key;

    browser.actions().sendKeys(Key.chord(Key.ALT, key))
        .perform();
Severity: Major
Found in e2e/client/specs/helpers/utils.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/utils.ts on lines 126..131

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

        const maximumLengthField: IFormField = {
            label: gettext('Maximum length'),
            type: FormFieldType.number,
            field: 'maxlength',
            required: false,
scripts/apps/workspace/content/components/get-content-profiles-form-config.tsx on lines 160..168

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

            } else if (desks.isOutputType(card.type)) {
                var deskId = card._id.substring(0, card._id.indexOf(':'));

                card.header = self.deskLookup[deskId].name;
            } else if (card.type === 'search') {
Severity: Major
Found in scripts/apps/monitoring/controllers/AggregateCtrl.ts and 1 other location - About 1 hr to fix
scripts/apps/monitoring/directives/AggregateSettings.ts on lines 256..260

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

                    if (desks.isOutputType(item.type)) {
                        var deskId = item._id.substring(0, item._id.indexOf(':'));

                        item.name = desks.deskLookup[deskId].name;
                    }
Severity: Major
Found in scripts/apps/monitoring/directives/AggregateSettings.ts and 1 other location - About 1 hr to fix
scripts/apps/monitoring/controllers/AggregateCtrl.ts on lines 502..511

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

        const minimumLengthField: IFormField = {
            label: gettext('Minimum length'),
            type: FormFieldType.number,
            field: 'minlength',
            required: false,
scripts/apps/workspace/content/components/get-content-profiles-form-config.tsx on lines 170..178

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

            const fieldsMetaNext: IRundownItem['fields_meta'] =
                editor3Config.readOnly === true
                    ? fieldsMetaCurrent
                    : {
                        ...fieldsMetaCurrent,
scripts/extensions/broadcasting/src/rundown-templates/rundown-template-item-storage-adapter.tsx on lines 31..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 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

Function prepareForEditing has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function prepareForEditing(
    currentAction: IRundownItemAction,
    id: string | null,
    data: IRundownItemBase,
    onSave: (item: IRundownItemBase) => Promise<IRundownItemBase>,
Severity: Minor
Found in scripts/extensions/broadcasting/src/rundowns/prepare-create-edit.ts - About 1 hr to fix

    Function getFilters has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getFilters(filters: IRundownFilters | undefined): ILogicalOperator | undefined {
        const queryFilters: IAndOperator['$and'] = [];
    
        if (filters?.show != null) {
            queryFilters.push({show: {$eq: filters.show}});
    Severity: Minor
    Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx - About 1 hr to fix

      Function render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          render() {
              return (
                  <SelectFromEndpoint
                      label={this.props.showLabel !== false ? gettext('Show') : undefined}
                      endpoint="/shows"

        Function exports has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(grunt) {
            return {
                importApps: [
                    '../index',
                ],
        Severity: Minor
        Found in e2e/client/superdesk.config.js - About 1 hr to fix

          Function removeInvalidTranslations has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function removeInvalidTranslations(jsonFilePath, filename) {
              var translations = JSON.parse(fs.readFileSync(jsonFilePath, 'utf8'));
          
              const KEY_REGEX = /{{ ?(.+?) ?}}/g;
          
          
          Severity: Minor
          Found in build-tools/src/po-to-json/index.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language