superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function IngestRulesContent has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function IngestRulesContent(api, notify, modal, $filter) {
    return {
        templateUrl: 'scripts/apps/ingest/views/settings/ingest-rules-content.html',
        link: function(scope) {
            var _orig = null;
Severity: Major
Found in scripts/apps/ingest/directives/IngestRulesContent.ts - About 2 hrs to fix

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

            link: function(scope, elem) {
                scope.requestEditor3DirectivesToGenerateHtml = [];
    
                scope.$watch('article', (newVal, oldVal) => {
                    if (newVal && newVal !== oldVal) {
    Severity: Major
    Found in scripts/apps/authoring/multiedit/multiedit.ts - About 2 hrs to fix

      Function editor3StateToHtml has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const editor3StateToHtml = (
          contentState: ContentState,
          disabled: Array<string> = [], // A set of disabled elements (ie. ['table'] will ignore
      ): string => {
          const annotationsByStyleName = getAnnotationsFromContentState(contentState)
      Severity: Major
      Found in scripts/core/editor3/html/to-html/editor3StateToHtml.ts - About 2 hrs to fix

        Function getRightRangeAndTextForStyle has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getRightRangeAndTextForStyle(editorState, style) {
            /* eslint-disable complexity */
            const type = getHighlightTypeFromStyleName(style);
            const selection = editorState.getSelection();
            const content = editorState.getCurrentContent();
        Severity: Major
        Found in scripts/core/editor3/helpers/highlights.ts - About 2 hrs to fix

          Function DeskNotificationsService has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function DeskNotificationsService($rootScope, api, session) {
              this._items = {};
              this.unread = {};
          
              /**
          Severity: Major
          Found in scripts/core/menu/notifications/notifications.ts - About 2 hrs to fix

            File assetEditor.tsx has 269 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // External modules
            import * as React from 'react';
            import {connect} from 'react-redux';
            import {noop, cloneDeep} from 'lodash';
            
            
            Severity: Minor
            Found in scripts/extensions/sams/src/components/assets/assetEditor.tsx - About 2 hrs to fix

              File AssociationController.ts has 269 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {forEach, startsWith, endsWith, some} from 'lodash';
              import {gettext, gettextPlural} from 'core/utils';
              import {isMediaEditable} from 'core/config';
              import {isPublished} from 'apps/archive/utils';
              import {IArticle, IVocabulary, IRelatedArticle} from 'superdesk-api';
              Severity: Minor
              Found in scripts/apps/authoring/authoring/controllers/AssociationController.ts - About 2 hrs to fix

                File notification.ts has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /**
                * This file is part of Superdesk.
                *
                * Copyright 2015 Sourcefabric z.u. and contributors.
                *
                Severity: Minor
                Found in scripts/core/notification/notification.ts - About 2 hrs to fix

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

                                              <DurationInput
                                                  label={gettext('Duration from')}
                                                  seconds={filters.duration?.gte ?? 0}
                                                  onChange={(val) => {
                                                      this.props.onChange({
                  scripts/extensions/broadcasting/src/rundowns/components/filtering-inputs.tsx on lines 121..132

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

                  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

                                              <TimePicker
                                                  label={gettext('Airtime time to')}
                                                  value={filters.airtime_time?.lte ?? ''}
                                                  onChange={(val) => {
                                                      this.props.onChange({
                  scripts/extensions/broadcasting/src/rundowns/components/filtering-inputs.tsx on lines 42..53

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

                  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

                  MultiTextInput.propTypes = {
                      remove: PropTypes.func,
                      field: PropTypes.string,
                      type: PropTypes.string,
                      value: PropTypes.string,
                  Severity: Major
                  Found in scripts/apps/contacts/components/Form/MultiTextInput.tsx and 1 other location - About 2 hrs to fix
                  scripts/core/ui/components/Form/SelectTagInput/SelectTagPopup.tsx on lines 138..147

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

                  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

                                              <DurationInput
                                                  label={gettext('Duration to')}
                                                  seconds={filters.duration?.lte ?? 0}
                                                  onChange={(val) => {
                                                      this.props.onChange({
                  scripts/extensions/broadcasting/src/rundowns/components/filtering-inputs.tsx on lines 108..119

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

                  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

                                              <TimePicker
                                                  label={gettext('Airtime time from')}
                                                  value={filters.airtime_time?.gte ?? ''}
                                                  onChange={(val) => {
                                                      this.props.onChange({
                  scripts/extensions/broadcasting/src/rundowns/components/filtering-inputs.tsx on lines 55..66

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

                  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

                  SelectTagPopup.propTypes = {
                      value: PropTypes.array,
                      options: PropTypes.array,
                      onClose: PropTypes.func,
                      target: PropTypes.string,
                  scripts/apps/contacts/components/Form/MultiTextInput.tsx on lines 85..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 84.

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

                      render() {
                          const Container = this.props.container;
                          const {readOnly, config} = this.props;
                          const mediaItems = this.getMediaItems();
                          const canAddMultipleItems = this.getMaxRemainingItemsCount() > 1;
                  Severity: Major
                  Found in scripts/apps/authoring-react/fields/media/editor.tsx - About 2 hrs to fix

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

                                link: function(scope, elem) {
                                    var bounds, boundx, boundy;
                    
                                    var updateScope = _.throttle((c) => {
                                        scope.$apply(() => {
                    Severity: Major
                    Found in scripts/core/upload/crop-directive.ts - About 2 hrs to fix

                      File virtual-list-from-query.tsx has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /* eslint-disable max-depth */
                      import React from 'react';
                      import {Map} from 'immutable';
                      import {debounce, omit, trimStart} from 'lodash';
                      import {Set} from 'immutable';
                      Severity: Minor
                      Found in scripts/core/ui/components/virtual-lists/virtual-list-from-query.tsx - About 2 hrs to fix

                        Function render has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                            render() {
                                const statuses = Map<string, IVocabularyItem>(
                                    vocabulary.getVocabulary(STATUS_VOCABULARY_ID).items.map((item) => [item.qcode, item]),
                                );
                        
                        

                        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 getContentProfileFormConfig has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function getContentProfileFormConfig(
                            editor: IContentProfileEditorConfig,
                            schema: any,
                            customFields: Array<any>,
                            field?: Partial<IContentProfileFieldWithSystemId> | undefined,

                        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 SearchProviderConfigDirective has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export default function SearchProviderConfigDirective(searchProviderService, notify, api, modal) {
                            return {
                                templateUrl: 'scripts/apps/search-providers/views/search-provider-config.html',
                                link: function($scope) {
                                    $scope.provider = null;
                        Severity: Minor
                        Found in scripts/apps/search-providers/directive.ts - About 2 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