superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function PackageItemsEdit has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function PackageItemsEdit(packages: IPackagesService, notify, $rootScope) {
    return {
        scope: false,
        require: 'ngModel',
        templateUrl: 'scripts/apps/packaging/views/sd-package-items-edit.html',
Severity: Major
Found in scripts/apps/packaging/directives/PackageItemsEdit.ts - About 4 hrs to fix

    Function ArchiveService has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function ArchiveService(desks, session, api, $q, search, $location) {
        /**
         * Adds 'task' property to the article represented by item.
         *
         * @param {Object} item
    Severity: Major
    Found in scripts/apps/archive/services/ArchiveService.ts - About 4 hrs to fix

      Function MonitoringController has 113 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function MonitoringController($rootScope, $scope, $location, desks, superdeskFlags,
          search, $filter, preferencesService, $q) {
          this.state = {};
      
          this.preview = preview;
      Severity: Major
      Found in scripts/apps/monitoring/controllers/MonitoringController.ts - About 4 hrs to fix

        Function TasksController has 113 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function TasksController($scope, $timeout, api, notify, desks, tasks, $filter, archiveService) {
            var KANBAN_VIEW = 'kanban',
                timeout;
        
            $scope.selected = {};
        Severity: Major
        Found in scripts/apps/dashboard/workspace-tasks/tasks.ts - About 4 hrs to fix

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

              constructor() {
                  /** List of templates on template settings list **/
                  this.list = element.all(by.repeater('template in content_templates._items'));
                  /** For an item from templates settings list, get his name **/
                  this.name = element(by.model('template.name'));
          Severity: Major
          Found in e2e/client/specs/helpers/templates.ts - About 4 hrs to fix

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

                            {
                                filters.duration?.lte != null && (
                                    <Tag
                                        text={getDurationString(filters.duration.lte)}
                                        label={gettext('Duration to')}
            scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 118..134

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

            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

                            {
                                filters.duration?.gte != null && (
                                    <Tag
                                        text={getDurationString(filters.duration.gte)}
                                        label={gettext('Duration from')}
            scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 136..152

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

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

                render() {
                    const ulClass = 'upload-thumbs flex-grid flex-grid--boxed flex-grid--wrap-items flex-grid--small-4';
            
                    return (
                        <Modal
            Severity: Major
            Found in scripts/apps/authoring/attachments/UploadAttachmentsModal.tsx - About 4 hrs to fix

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

                              <div style={{paddingBlockStart: 5}}>
                                  <ControlledVocabulariesSelect
                                      zIndex={2000}
                                      vocabularies={this.state.regions}
                                      value={this.props.value.target_regions ?? []}
              scripts/core/interactive-article-actions-panel/subcomponents/publishing-target-select.tsx on lines 152..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 124.

              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 style={{paddingBlockStart: 5}}>
                                  <ControlledVocabulariesSelect
                                      zIndex={2000}
                                      vocabularies={this.state.subscriberTypes}
                                      value={this.props.value.target_types ?? []}
              scripts/core/interactive-article-actions-panel/subcomponents/publishing-target-select.tsx on lines 134..146

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

              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 macros.tsx has 351 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import {
                  IArticle,
                  IArticleSideWidget,
                  IContentProfileV2,
              Severity: Minor
              Found in scripts/apps/authoring-react/macros/macros.tsx - About 4 hrs to fix

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

                    render() {
                        const {article} = this.props;
                
                        const {
                            flags,
                Severity: Minor
                Found in scripts/apps/authoring-react/article-widgets/metadata/metadata.tsx - 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 RelatedItemsDirective has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                export function RelatedItemsDirective(
                    authoringWorkspace: AuthoringWorkspaceService,
                    relationsService,
                    notify,
                    lock,
                Severity: Minor
                Found in scripts/apps/relations/directives/RelatedItemsDirective.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 VocabularyEditController has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                export function VocabularyEditController(
                    $scope: IScope, notify, api, metadata, cvSchema, relationsService, $timeout,
                ) {
                    let componentRef: VocabularyItemsViewEdit = null;
                
                
                Severity: Minor
                Found in scripts/apps/vocabularies/controllers/VocabularyEditController.tsx - 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 WidgetsManagerCtrl has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                function WidgetsManagerCtrl(
                    $scope: IScope,
                    $routeParams,
                    authoringWidgets: Array<IWidget>,
                    archiveService,
                Severity: Minor
                Found in scripts/apps/authoring/widgets/widgets.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 PreferencesService has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                        function PreferencesService($injector, $rootScope, $q, session, notify, _) {
                            var USER_PREFERENCES = 'user_preferences',
                                SESSION_PREFERENCES = 'session_preferences',
                                ACTIVE_PRIVILEGES = 'active_privileges',
                                ACTIONS = 'allowed_actions',
                Severity: Minor
                Found in scripts/core/services/preferencesService.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 getInlineToolbarActions has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    getInlineToolbarActions(
                        {
                            item,
                            hasUnsavedChanges,
                            save,
                Severity: Major
                Found in scripts/apps/authoring-react/multi-edit-modal.tsx - About 4 hrs to fix

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

                          link: function(scope) {
                              function getCount() {
                                  var criteria = {
                                      source: {
                                          query: {
                  Severity: Major
                  Found in scripts/apps/ingest/directives/IngestUserDashboard.ts - About 4 hrs to fix

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

                        render() {
                            const {onRemove, isAuthor, isReply} = this.props;
                    
                            const {author, authorId, date} = this.props.data;
                    
                    
                    Severity: Major
                    Found in scripts/core/editor3/components/comments/Comment.tsx - About 4 hrs to fix

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

                              this.removeFromFirstDesk = function(group, item) {
                                  var crtItem = this.getItem(group, item);
                      
                                  crtItem.element(by.className('icon-bell')).click();
                                  var deskList = element(by.className('highlights-list-menu'));
                      Severity: Major
                      Found in e2e/client/specs/helpers/monitoring.ts and 1 other location - About 4 hrs to fix
                      e2e/client/specs/helpers/monitoring.ts on lines 836..844

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

                      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