superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function MetaTagsDirective has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function MetaTagsDirective(api, $timeout) {
    var ENTER = 13;
    var ESC = 27;

    return {
Severity: Major
Found in scripts/apps/authoring/metadata/metadata.ts - About 3 hrs to fix

    Function link has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            link: function(scope: ISavedSearchesScope) {
                const resource = api('saved_searches');
    
                scope.config = appConfig;
    
    
    Severity: Major
    Found in scripts/apps/search/directives/SavedSearches.ts - About 3 hrs to fix

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

          render() {
              return (
                  <Popup
                      close={this.props.close}
                      target={this.props.target}
      Severity: Major
      Found in scripts/core/ui/components/Form/DateInput/DateInputPopup.tsx - About 3 hrs to fix

        File ItemCarouselDirective.ts has 296 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import 'owl.carousel';
        import _ from 'lodash';
        import * as ctrl from '../controllers';
        import {waitForMediaToLoad} from 'core/helpers/waitForMediaToBeReady';
        import {gettext, gettextPlural} from 'core/utils';
        Severity: Minor
        Found in scripts/apps/authoring/authoring/directives/ItemCarouselDirective.ts - About 3 hrs to fix

          File MultiImageEdit.ts has 296 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import _ from 'lodash';
          import {get} from 'lodash';
          import {uniq, pickBy, isEmpty, forEach} from 'lodash';
          import {validateMediaFieldsThrows} from 'apps/authoring/authoring/controllers/ChangeImageController';
          import {logger} from 'core/services/logger';
          Severity: Minor
          Found in scripts/apps/search/MultiImageEdit.ts - About 3 hrs to fix

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

                return httpRequestJsonLocal<IArticle>({
                    method: 'PATCH',
                    path: `/archive/${item._id}`,
                    payload: {
                        publish_schedule: null,
            Severity: Major
            Found in scripts/api/article.ts and 2 other locations - About 3 hrs to fix
            scripts/api/article.ts on lines 102..121
            scripts/api/article.ts on lines 148..170

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

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

                return httpRequestJsonLocal<IArticle>({
                    method: 'PATCH',
                    path: `/archive/unspike/${item._id}`,
                    payload: {
                        task: {
            Severity: Major
            Found in scripts/api/article.ts and 2 other locations - About 3 hrs to fix
            scripts/api/article.ts on lines 102..121
            scripts/api/article.ts on lines 125..144

            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

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

                                    if (angular.isDefined(response.data._issues)) {
                                        if (response.data._issues.name && response.data._issues.name.unique) {
                                            notify.error(gettext('Error: Name needs to be unique'));
                                        } else {
                                            notify.error(gettext('Error: ' + JSON.stringify(response.data._issues)));
            scripts/apps/content-filters/controllers/ManageContentFiltersController.ts on lines 65..77

            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

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

                                    } else if (angular.isDefined(response.data._issues)) {
                                        if (response.data._issues.name && response.data._issues.name.unique) {
                                            notify.error(gettext('Error: Name needs to be unique'));
                                        } else {
                                            notify.error(gettext('Error: ' + JSON.stringify(response.data._issues)));
            scripts/apps/content-filters/controllers/FilterConditionsController.ts on lines 103..113

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

                                        {
                                            showTitle === true ? null : (
                                                <Textarea
                                                    placeholder={gettext('Title')}
                                                    onFocus={setLocked}
            Severity: Major
            Found in scripts/core/editor3/components/media/MediaBlock.tsx and 1 other location - About 3 hrs to fix
            scripts/core/editor3/components/media/MediaBlock.tsx on lines 213..225

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

                                        {
                                            showTitle === true ? null : (
                                                <Textarea
                                                    placeholder={gettext('Title')}
                                                    onFocus={setLocked}
            Severity: Major
            Found in scripts/core/editor3/components/media/MediaBlock.tsx and 1 other location - About 3 hrs to fix
            scripts/core/editor3/components/media/MediaBlock.tsx on lines 252..264

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

                                                    <Spacer h gap="4" justifyContent="space-between" noWrap>
                                                        <span className="label">{translation.language}</span>
                                                        <span className="sd-overflow-ellipsis sd-list-item--element-grow">
                                                            {translation.headline}
                                                        </span>
            scripts/apps/authoring/translations/translationsWidget.tsx on lines 33..41

            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

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

                return httpRequestJsonLocal<void>({
                    method: 'PATCH',
                    path: `/archive/spike/${item._id}`,
                    payload: {
                        state: 'spiked',
            Severity: Major
            Found in scripts/api/article.ts and 2 other locations - About 3 hrs to fix
            scripts/api/article.ts on lines 125..144
            scripts/api/article.ts on lines 148..170

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

                    this.edit = function(name) {
                        this.getSubscriber(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/subscribers.ts and 2 other locations - About 3 hrs to fix
            e2e/client/specs/helpers/dictionaries.ts on lines 56..62
            e2e/client/specs/helpers/highlights.ts on lines 73..79

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

                                        <div className="sd-list-item__row">
                                            <span className="label">{translation.language}</span>
                                            <span className="sd-overflow-ellipsis sd-list-item--element-grow">
                                                {translation.headline}
                                            </span>
            Severity: Major
            Found in scripts/apps/authoring/translations/translationsWidget.tsx and 1 other location - About 3 hrs to fix
            scripts/apps/authoring-react/article-widgets/translations/translations.tsx on lines 41..49

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

                                    <div>
                                        <Checkbox
                                            label={{text: gettext('Round corners for dropdown items')}}
                                            checked={config.roundCorners}
                                            onChange={(val: IDropdownConfig['roundCorners']) => {
            scripts/apps/authoring-react/fields/dropdown/config-main.tsx on lines 120..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 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 2 locations. Consider refactoring.
            Open

                                <div>
                                    <Checkbox
                                        label={{text: gettext('Allow selecting multiple values')}}
                                        checked={config.multiple}
                                        onChange={(val: IDropdownConfig['multiple']) => {
            Severity: Major
            Found in scripts/apps/authoring-react/fields/dropdown/config-main.tsx and 1 other location - About 3 hrs to fix
            scripts/apps/authoring-react/fields/dropdown/dropdown-manual-entry/config.tsx on lines 251..262

            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

            Function DatepickerInnerDirective has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

            function DatepickerInnerDirective($compile, $document, popupService, datetimeHelper) {
                var popupTpl = '<div sd-datepicker-wrapper ng-model="date">' +
                    '<div datepicker format-day="d" starting-day="' + appConfig.startingDay + '" show-weeks="false"></div>' +
                '</div>';
            
            
            Severity: Minor
            Found in scripts/core/ui/ui.ts - About 3 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

            Severity
            Category
            Status
            Source
            Language