superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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-dots-vertical')).click();
                rows[0].element(by.className('icon-pencil')).click();
Severity: Major
Found in e2e/client/specs/helpers/templates.ts and 2 other locations - About 4 hrs to fix
e2e/client/specs/helpers/content_profiles.ts on lines 94..101
e2e/client/specs/helpers/desks.ts on lines 124..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 131.

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-dots-vertical')).click();
                rows[0].element(by.className('icon-pencil')).click();
Severity: Major
Found in e2e/client/specs/helpers/desks.ts and 2 other locations - About 4 hrs to fix
e2e/client/specs/helpers/content_profiles.ts on lines 94..101
e2e/client/specs/helpers/templates.ts on lines 251..258

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

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 render has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render() {
        if (this.state.actions == null) {
            return null;
        }

Severity: Major
Found in scripts/apps/monitoring/MultiActionBarReact.tsx - About 4 hrs to fix

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

        render(): JSX.Element {
            const availableDesks = sdApi.desks.getAllDesks().toArray();
    
            if (!this.state.initialized) {
                return null;
    Severity: Major
    Found in scripts/apps/authoring-react/toolbar/template-modal.tsx - About 4 hrs to fix

      Function IngestUserDashboard has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function IngestUserDashboard(api, userList, privileges, moment) {
          return {
              templateUrl: 'scripts/apps/ingest/views/dashboard/ingest-dashboard-widget.html',
              scope: {
                  item: '=',
      Severity: Major
      Found in scripts/apps/ingest/directives/IngestUserDashboard.ts - About 4 hrs to fix

        File SearchParameters.ts has 365 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import {getParameters} from 'apps/search/constants';
        import {getDateFilters} from './DateFilters';
        import _ from 'lodash';
        
        /**
        Severity: Minor
        Found in scripts/apps/search/directives/SearchParameters.ts - About 4 hrs to fix

          Function renderEditor3 has 119 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                          const renderEditor3 = () => {
                              const element = $element.get(0);
          
                              ReactDOM.unmountComponentAtNode(element);
          
          
          Severity: Major
          Found in scripts/core/editor3/directive.tsx - About 4 hrs to fix

            Function AggregateSettings has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
            Open

            export function AggregateSettings(desks, workspaces, session, preferencesService, WizardHandler, $filter) {
                return {
                    templateUrl: 'scripts/apps/monitoring/views/aggregate-settings-configuration.html',
                    scope: {
                        modalActive: '=',
            Severity: Minor
            Found in scripts/apps/monitoring/directives/AggregateSettings.ts - About 4 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function IngestUserDashboard has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
            Open

            export function IngestUserDashboard(api, userList, privileges, moment) {
                return {
                    templateUrl: 'scripts/apps/ingest/views/dashboard/ingest-dashboard-widget.html',
                    scope: {
                        item: '=',
            Severity: Minor
            Found in scripts/apps/ingest/directives/IngestUserDashboard.ts - About 4 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function SuperdeskProvider has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
            Open

            function SuperdeskProvider($routeProvider, _) {
                var widgets = {};
                var activities: any = {};
                var permissions = {};
                var panes = {};
            Severity: Minor
            Found in scripts/core/activity/activity.ts - About 4 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                                            <div className="form__group">
                                                <div className="form__item">
                                                    <div className="sd-input">
                                                        <label className="sd-input__label">{gettext('Slugline')}</label>
                                                        <input
            scripts/apps/master-desk/components/FilterPanelComponent.tsx on lines 138..151
            scripts/apps/master-desk/components/FilterPanelComponent.tsx on lines 153..166

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

            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

                                            <div className="form__group">
                                                <div className="form__item">
                                                    <div className="sd-input">
                                                        <label className="sd-input__label">{gettext('Headline')}</label>
                                                        <input
            scripts/apps/master-desk/components/FilterPanelComponent.tsx on lines 123..136
            scripts/apps/master-desk/components/FilterPanelComponent.tsx on lines 153..166

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

            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

                                            <div className="form__group">
                                                <div className="form__item">
                                                    <div className="sd-input">
                                                        <label className="sd-input__label">{gettext('Byline')}</label>
                                                        <input
            scripts/apps/master-desk/components/FilterPanelComponent.tsx on lines 123..136
            scripts/apps/master-desk/components/FilterPanelComponent.tsx on lines 138..151

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

            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

            File data-layer.ts has 364 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {OrderedMap} from 'immutable';
            import {
                IArticle,
                IAuthoringFieldV2,
                IFieldsV2,
            Severity: Minor
            Found in scripts/apps/authoring-react/data-layer.ts - About 4 hrs to fix

              File WidgetGroup.ts has 364 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import ReactDOM from 'react-dom';
              import _ from 'lodash';
              
              import {WidgetItemList as WidgetItemListComponent} from 'apps/search/components';
              Severity: Minor
              Found in scripts/apps/monitoring/directives/WidgetGroup.ts - About 4 hrs to fix

                File activity.ts has 364 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {forEach} from 'lodash';
                import langmap from 'core/lang';
                import {gettext} from 'core/utils';
                import {dashboardRoute, appConfig} from 'appConfig';
                import {IActivity} from 'superdesk-interfaces/Activity';
                Severity: Minor
                Found in scripts/core/activity/activity.ts - About 4 hrs to fix

                  Function makeConfig has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function makeConfig(grunt) {
                      var appConfigPath = path.join(process.cwd(), 'superdesk.config.js');
                  
                      if (process.env.SUPERDESK_CONFIG) {
                          appConfigPath = path.join(process.cwd(), process.env.SUPERDESK_CONFIG);
                  Severity: Major
                  Found in webpack.config.js - About 4 hrs to fix

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

                            const fieldConfig: IDropdownConfigManualSource = {
                                source: 'manual-entry',
                                type: 'number',
                                options: vocabulary.items.map(({name, qcode, color}) => {
                                    const option: IDropdownConfigManualSource['options'][0] = {
                    Severity: Major
                    Found in scripts/apps/authoring-react/field-adapters/priority.ts and 1 other location - About 4 hrs to fix
                    scripts/apps/authoring-react/field-adapters/urgency.ts on lines 19..33

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

                    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 fieldConfig: IDropdownConfigManualSource = {
                                source: 'manual-entry',
                                type: 'number',
                                options: vocabulary.items.map(({name, qcode, color}) => {
                                    const option: IDropdownConfigManualSource['options'][0] = {
                    Severity: Major
                    Found in scripts/apps/authoring-react/field-adapters/urgency.ts and 1 other location - About 4 hrs to fix
                    scripts/apps/authoring-react/field-adapters/priority.ts on lines 20..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 129.

                    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.setDestinationFormat = function(ingestType) {
                                element(by.id('destination-format')).all(by.tagName('option'))
                                    .filter((elem, index) => elem.getText().then((label) => label.toLowerCase().indexOf(ingestType) > -1))
                                    .then((options) => {
                                        options[0].click();
                    Severity: Major
                    Found in e2e/client/specs/helpers/subscribers.ts and 1 other location - About 4 hrs to fix
                    e2e/client/specs/helpers/subscribers.ts on lines 48..54

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language