superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

    render() {
        const {
            required,
            value,
            label,
Severity: Major
Found in scripts/core/ui/components/Form/ColouredValueInput/index.tsx - About 2 hrs to fix

    Function renderMultiLevelSelect has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        renderMultiLevelSelect() {
            return (
                <Popup
                    close={this.props.onCancel}
                    target={this.props.target}

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

          constructor() {
              /**
               * Open dashboard for current selected desk/custom workspace.
               */
              this.openDashboard = function() {
      Severity: Major
      Found in e2e/client/specs/helpers/dashboard.ts - About 2 hrs to fix

        File samsWorkspace.tsx has 276 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* eslint-disable react/no-multi-comp */
        
        // External Modules
        import * as React from 'react';
        import {Dispatch, Store} from 'redux';
        Severity: Minor
        Found in scripts/extensions/sams/src/apps/samsWorkspace.tsx - About 2 hrs to fix

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

              render() {
                  const resolutions = [{label: 'Same', value: 0}].concat(
                      [480, 720, 1080]
                          .filter((i) => i < this.props.videoResolution)
                          .map((i) => ({label: i + 'p', value: i})),
          Severity: Major
          Found in scripts/extensions/videoEditor/src/VideoEditorTools.tsx - About 2 hrs to fix

            Function WorkspaceSidenavDirective has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function WorkspaceSidenavDirective(superdeskFlags, Keys,
                $rootScope, workspaces, privileges) {
                return {
                    template: require('../views/workspace-sidenav-items.html'),
                    link: function(scope, elem) {
            Severity: Major
            Found in scripts/apps/workspace/directives/WorkspaceSidenavDirective.ts - About 2 hrs to fix

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

                      render() {
                          const modalInformationLabel = gettext(`Please be aware that uploading external config files
                              will overwrite your existing configuration.`);
                          const dropZoneLabel = gettext(`Drag one or more files here to upload them,
                              or select files by clicking the button below`);
              Severity: Major
              Found in scripts/apps/vocabularies/components/UploadConfigModal.tsx - About 2 hrs to fix

                File AuthoringHeaderDirective.ts has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {
                    isNull, isUndefined, find, filter, keys, findIndex,
                    sortBy, map, forEach, startsWith, flatMap} from 'lodash';
                import {FIELD_KEY_SEPARATOR} from 'core/editor3/helpers/fieldsMeta';
                import {AuthoringWorkspaceService} from '../services/AuthoringWorkspaceService';

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

                                              <FormGroup>
                                                  <FormItem>
                                                      <Input
                                                          type="text"
                                                          label={gettext('Name')}
                  scripts/extensions/sams/src/components/assets/assetFilterPanel.tsx on lines 250..259
                  scripts/extensions/sams/src/components/assets/assetFilterPanel.tsx on lines 260..269

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

                  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

                              _.each(params, (param) => {
                                  $scope.operatorLookup[param.field] = param.operators;
                                  $scope.valueLookup[param.field] = param.values;
                                  $scope.valueFieldLookup[param.field] = param.value_field;
                              });
                  scripts/apps/content-filters/controllers/FilterConditionsController.ts on lines 175..179

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

                  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

                                              <FormGroup>
                                                  <FormItem>
                                                      <Input
                                                          type="text"
                                                          label={gettext('Filename')}
                  scripts/extensions/sams/src/components/assets/assetFilterPanel.tsx on lines 240..249
                  scripts/extensions/sams/src/components/assets/assetFilterPanel.tsx on lines 260..269

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

                  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

                                  _.each(params, (param) => {
                                      $scope.operatorLookup[param.field] = param.operators;
                                      $scope.valueLookup[param.field] = param.values;
                                      $scope.valueFieldLookup[param.field] = param.value_field;
                                  });
                  scripts/apps/content-filters/controllers/FilterSearchController.ts on lines 59..63

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

                  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

                                              <FormGroup>
                                                  <FormItem>
                                                      <Input
                                                          type="text"
                                                          label={gettext('Description')}
                  scripts/extensions/sams/src/components/assets/assetFilterPanel.tsx on lines 240..249
                  scripts/extensions/sams/src/components/assets/assetFilterPanel.tsx on lines 250..259

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

                  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

                                                      onChange={(val) => {
                                                          this.setState(
                                                              {publishingTarget: val},
                                                              () => {
                                                                  this.props.onDataChange?.({
                  scripts/core/interactive-article-actions-panel/actions/publish-tab.tsx on lines 212..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 87.

                  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

                                  filter = {
                                      brightness: scope.brightness ? 'brightness(' + scope.brightness + ') ' : '',
                                      contrast: scope.contrast ? 'contrast(' + scope.contrast + ') ' : '',
                                      saturate: scope.saturate ? 'saturate(' + scope.saturate + ') ' : '',
                                  },
                  Severity: Major
                  Found in scripts/core/upload/sdImageModify.ts and 1 other location - About 2 hrs to fix
                  scripts/core/upload/sdImageModify.ts on lines 25..29

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

                  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

                  function getAllDesks(): OrderedMap<IDesk['_id'], IDesk> {
                      let desksMap: OrderedMap<IDesk['_id'], IDesk> = OrderedMap();
                  
                      for (const desk of ng.get('desks').desks._items) {
                          desksMap = desksMap.set(desk._id, desk);
                  Severity: Major
                  Found in scripts/api/desks.ts and 1 other location - About 2 hrs to fix
                  scripts/api/desks.ts on lines 38..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 87.

                  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

                                  transform = {
                                      rotate: scope.rotate ? 'rotateZ(' + scope.rotate + 'deg) ' : '',
                                      flipH: scope.flipH ? 'rotateY(' + scope.fliph + 'deg) ' : '',
                                      flipV: scope.flipV ? 'rotateX(' + scope.flipv + 'deg) ' : '',
                                  };
                  Severity: Major
                  Found in scripts/core/upload/sdImageModify.ts and 1 other location - About 2 hrs to fix
                  scripts/core/upload/sdImageModify.ts on lines 20..24

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

                  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

                                                      onChange={(val) => {
                                                          this.setState(
                                                              {publishingDateOptions: val},
                                                              () => {
                                                                  this.props.onDataChange?.({
                  scripts/core/interactive-article-actions-panel/actions/publish-tab.tsx on lines 231..244

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

                  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

                  function getDeskStages(deskId: IDesk['_id']): OrderedMap<IStage['_id'], IStage> {
                      let stagesMap: OrderedMap<IStage['_id'], IStage> = OrderedMap();
                  
                      for (const stage of ng.get('desks').deskStages[deskId]) {
                          stagesMap = stagesMap.set(stage._id, stage);
                  Severity: Major
                  Found in scripts/api/desks.ts and 1 other location - About 2 hrs to fix
                  scripts/api/desks.ts on lines 24..32

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

                  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 ArchiveService has a Cognitive Complexity of 19 (exceeds 5 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: Minor
                  Found in scripts/apps/archive/services/ArchiveService.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