superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function getAuthoringField has 152 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function getAuthoringField(
    fieldId: string,
    item: IArticle,
    customFieldsVocabularies: Array<IVocabulary>,
): IAuthoringField {
Severity: Major
Found in scripts/apps/authoring/preview/getAuthoringField.ts - About 6 hrs to fix

    Function PreferencesService has 152 lines of code (exceeds 25 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: Major
    Found in scripts/core/services/preferencesService.ts - About 6 hrs to fix

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

      export default angular.module('superdesk.apps.publish', ['superdesk.apps.users', 'superdesk.apps.content_filters'])
      
          .service('adminPublishSettingsService', svc.AdminPublishSettingsService)
          .service('subscribersService', svc.SubscribersService)
      
      
      Severity: Major
      Found in scripts/apps/publish/index.ts and 1 other location - About 6 hrs to fix
      scripts/apps/archive/index.tsx on lines 73..403

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

      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

      angular.module('superdesk.apps.archive', [
          'superdesk.apps.search',
          'superdesk.apps.archive.directives',
          'superdesk.apps.dashboard',
          'superdesk.apps.dashboard.widgets.base',
      Severity: Major
      Found in scripts/apps/archive/index.tsx and 1 other location - About 6 hrs to fix
      scripts/apps/publish/index.ts on lines 26..81

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

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

      import React, {Fragment} from 'react';
      import {IArticleSideWidget, IExtensionActivationResult, IVocabularyItem} from 'superdesk-api';
      import {gettext} from 'core/utils';
      import {AuthoringWidgetHeading} from 'apps/dashboard/widget-heading';
      import {AuthoringWidgetLayout} from 'apps/dashboard/widget-layout';
      Severity: Minor
      Found in scripts/apps/authoring-react/article-widgets/metadata/metadata.tsx - About 6 hrs to fix

        Function TemplatesService has 150 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function TemplatesService(api, session, $q, preferencesService, privileges, desks) {
            var PAGE_SIZE = 10;
            var PREFERENCES_KEY = 'templates:recent';
        
            var KILL_TEMPLATE_IGNORE_FIELDS = ['dateline', 'template_desks', 'schedule_desk',
        Severity: Major
        Found in scripts/apps/templates/services/TemplatesService.ts - About 6 hrs to fix

          Function WorkqueueCtrl has 150 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function WorkqueueCtrl(
              $scope,
              $rootScope,
              $route,
              workqueue: WorkqueueService,
          Severity: Major
          Found in scripts/apps/authoring/workqueue/workqueue.ts - About 6 hrs to fix

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

                constructor() {
                    this.list = element.all(by.repeater('config in configurations._items'));
                    this.name = element(by.model('configEdit.name'));
                    this.desks = element.all(by.repeater('desk in assignedDesks'));
                    this.groups = element.all(by.repeater('group in configEdit.groups'));
            Severity: Major
            Found in e2e/client/specs/helpers/highlights.ts - About 6 hrs to fix

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

                      (response) => {
                          if (angular.isDefined(response.data._issues) &&
                              angular.isDefined(response.data._issues['validator exception'])) {
                              notify.error(gettext('Error: ' + response.data._issues['validator exception']));
                          } else if (angular.isDefined(response.data._message)) {
              Severity: Major
              Found in scripts/apps/users/controllers/UserEnableCommand.ts and 1 other location - About 6 hrs to fix
              scripts/apps/users/controllers/UserDeleteCommand.ts on lines 17..26

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

              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

                      (response) => {
                          if (angular.isDefined(response.data._issues) &&
                              angular.isDefined(response.data._issues['validator exception'])) {
                              notify.error(gettext('Error: ' + response.data._issues['validator exception']));
                          } else if (angular.isDefined(response.data._message)) {
              Severity: Major
              Found in scripts/apps/users/controllers/UserDeleteCommand.ts and 1 other location - About 6 hrs to fix
              scripts/apps/users/controllers/UserEnableCommand.ts on lines 14..23

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

              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

                                  <Row>
                                      <LineInput
                                          readOnly={readOnly}
                                          required={isRequired}
                                          invalid={showMinFieldsWarning}
              Severity: Major
              Found in scripts/apps/contacts/components/Form/ProfileDetail.tsx and 1 other location - About 5 hrs to fix
              scripts/apps/contacts/components/Form/ProfileDetail.tsx on lines 485..507

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

              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

                                  <Row>
                                      <LineInput
                                          readOnly={readOnly}
                                          required={isRequired}
                                          invalid={showMinFieldsWarning}
              Severity: Major
              Found in scripts/apps/contacts/components/Form/ProfileDetail.tsx and 1 other location - About 5 hrs to fix
              scripts/apps/contacts/components/Form/ProfileDetail.tsx on lines 509..531

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

              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

                              <WithLiveResources resources={[{resource: 'attachments', ids: ids}]}>
                                  {([res]: Array<IRestApiResponse<IAttachment>>) => {
                                      const attachments = res._items;
              
                                      return (
              Severity: Major
              Found in scripts/apps/authoring-react/fields/attachments/editor.tsx and 1 other location - About 5 hrs to fix
              scripts/apps/authoring-react/fields/attachments/authoring-widget.tsx on lines 77..93

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

              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

                                  <WithLiveResources resources={[{resource: 'attachments', ids: ids}]}>
                                      {([res]: Array<IRestApiResponse<IAttachment>>) => {
                                          const attachments = res._items;
              
                                          return (
              scripts/apps/authoring-react/fields/attachments/editor.tsx on lines 54..70

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

              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.remove = 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-trash')).click();
              Severity: Major
              Found in e2e/client/specs/helpers/desks.ts and 1 other location - About 5 hrs to fix
              e2e/client/specs/helpers/templates.ts on lines 264..272

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

              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.remove = 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-trash')).click();
              Severity: Major
              Found in e2e/client/specs/helpers/templates.ts and 1 other location - About 5 hrs to fix
              e2e/client/specs/helpers/desks.ts on lines 152..160

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

              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

                              <DropZone3
                                  canDrop={() => !readOnly}
                                  onDrop={(event) => {
                                      const item = getDroppedItem(event);
              
              
              Severity: Major
              Found in scripts/apps/authoring-react/fields/package-items/editor.tsx and 1 other location - About 5 hrs to fix
              scripts/apps/authoring-react/fields/linked-items/editor.tsx on lines 128..159

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

              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

                              <DropZone3
                                  canDrop={() => !readOnly}
                                  onDrop={(event) => {
                                      const item = getDroppedItem(event);
              
              
              Severity: Major
              Found in scripts/apps/authoring-react/fields/linked-items/editor.tsx and 1 other location - About 5 hrs to fix
              scripts/apps/authoring-react/fields/package-items/editor.tsx on lines 105..149

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

              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

                  getHighlights() {
                      let itemHighlights = [];
              
                      if (isCheckAllowed(this.props.item)) {
                          if (this.props.item.archive_item && this.props.item.archive_item.highlights &&
              Severity: Major
              Found in scripts/apps/search/components/HighlightsInfo.tsx and 1 other location - About 5 hrs to fix
              scripts/apps/search/components/MarkedDesksInfo.tsx on lines 42..55

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

              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

                  getMarkedDesks() {
                      let markedDesks = [];
              
                      if (isCheckAllowed(this.props.item)) {
                          if (this.props.item.archive_item && this.props.item.archive_item.marked_desks &&
              Severity: Major
              Found in scripts/apps/search/components/MarkedDesksInfo.tsx and 1 other location - About 5 hrs to fix
              scripts/apps/search/components/HighlightsInfo.tsx on lines 69..82

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

              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