superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

        return {
            getFieldV2: (fieldEditor, fieldSchema) => {
                const multiple = isMultiple('locators');

                const fieldConfig: IDropdownConfigVocabulary = {
Severity: Major
Found in scripts/apps/authoring-react/field-adapters/place.ts and 1 other location - About 2 days to fix
scripts/apps/authoring-react/field-adapters/genre.ts on lines 14..68

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

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

export function MonitoringGroup(
    cards,
    api,
    authoringWorkspace: AuthoringWorkspaceService,
    $timeout,
Severity: Major
Found in scripts/apps/monitoring/directives/MonitoringGroup.ts - About 2 days to fix

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

        render() {
            const {historyItems} = this.state;
    
            if (historyItems == null) {
                return null;

      Function AuthoringService has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring.
      Open

      export function AuthoringService(
          $q,
          $location,
          api,
          lock,
      Severity: Minor
      Found in scripts/apps/authoring/authoring/services/AuthoringService.ts - About 2 days 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 link has 462 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              link: function(scope: IScope, elem, attrs, ctrls) {
                  if (scope.group == null) {
                      scope.group = {};
                  }
      
      
      Severity: Major
      Found in scripts/apps/monitoring/directives/MonitoringGroup.ts - About 2 days to fix

        Function SearchResults has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring.
        Open

        export function SearchResults(
            $location,
            preferencesService,
            packages: IPackagesService,
            asset,
        Severity: Minor
        Found in scripts/apps/search/directives/SearchResults.ts - About 2 days 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 render has 449 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            render() {
                const {contact, onChange, readOnly, errors, contactType} = this.props;
        
                const contactLabel = contactType === 'person' ? gettext('Role') : gettext('Point of contact');
                const isRequired = get(this.state, 'requiredField', false);
        Severity: Major
        Found in scripts/apps/contacts/components/Form/ProfileDetail.tsx - About 2 days to fix

          Function SearchParameters has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring.
          Open

          export function SearchParameters($location, asset, tags, metadata, common, desks,
              userList, ingestSources, subscribersService, $templateCache, search) {
              return {
                  scope: {
                      repo: '=',
          Severity: Minor
          Found in scripts/apps/search/directives/SearchParameters.ts - About 2 days 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 AggregateCtrl has 433 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function AggregateCtrl($scope, desks, workspaces, preferencesService, storage,
              savedSearch, content) {
              const CONTENT_PROLFILE = gettext('Content profile');
              var PREFERENCES_KEY = 'agg:view';
              var defaultMaxItems = 10;
          Severity: Major
          Found in scripts/apps/monitoring/controllers/AggregateCtrl.ts - About 2 days to fix

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

            export class Difference extends React.PureComponent<IProps> {
                render() {
                    const value1Ids = (this.props.value1 ?? []).map(({guid}) => guid);
                    const value2Ids = (this.props.value2 ?? []).map(({guid}) => guid);
            
            
            scripts/apps/authoring-react/fields/linked-items/difference.tsx on lines 10..62

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

            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

            export class Difference extends React.PureComponent<IProps> {
                render() {
                    const value1Ids = (this.props.value1 ?? []).map(({id}) => id);
                    const value2Ids = (this.props.value2 ?? []).map(({id}) => id);
            
            
            scripts/apps/authoring-react/fields/package-items/difference.tsx on lines 10..61

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

            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 authoring.ts has 844 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable newline-per-chained-call */
            
            import {element, by, browser, protractor} from 'protractor';
            import {waitHidden, waitFor, click} from './utils';
            import {ECE, els, el} from '@superdesk/end-to-end-testing-helpers';
            Severity: Major
            Found in e2e/client/specs/helpers/authoring.ts - About 2 days to fix

              File AuthoringDirective.ts has 824 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {sdApi} from 'api';
              import {appConfig} from 'appConfig';
              import {ITEM_STATE} from 'apps/archive/constants';
              import {isPublished} from 'apps/archive/utils';
              import {authoringApiCommon} from 'apps/authoring-bridge/authoring-api-common';
              Severity: Major
              Found in scripts/apps/authoring/authoring/directives/AuthoringDirective.ts - About 1 day to fix

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

                    render() {
                        const rundown = this.state.rundownWithChanges;
                        const lockedInOtherSession = rundown == null ? true : isLockedInOtherSession(rundown);
                        const editingDisallowed = lockedInOtherSession || this.props.readOnly;
                
                
                Severity: Major
                Found in scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx - About 1 day to fix

                  Function SearchResults has 389 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function SearchResults(
                      $location,
                      preferencesService,
                      packages: IPackagesService,
                      asset,
                  Severity: Major
                  Found in scripts/apps/search/directives/SearchResults.ts - About 1 day to fix

                    Function ChangeImageController has 388 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function ChangeImageController($scope, notify, _, api, $rootScope, $q, content) {
                        $scope.data = $scope.locals.data;
                        $scope.data.cropData = {};
                        $scope.validator = appConfig.validator_media_metadata;
                        const sizes = {};
                    Severity: Major
                    Found in scripts/apps/authoring/authoring/controllers/ChangeImageController.ts - About 1 day to fix

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

                      function getItemTemplate(that: Editor) {
                          return class SortableItemComponent extends React.PureComponent<{item: IArticle}> {
                              render() {
                                  const {item} = this.props;
                                  const {readOnly} = that.props;
                      Severity: Major
                      Found in scripts/apps/authoring-react/fields/linked-items/editor.tsx and 1 other location - About 1 day to fix
                      scripts/apps/authoring-react/fields/package-items/editor.tsx on lines 23..77

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 340.

                      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 getItemTemplate(that: Editor) {
                          return class SortableItemComponent extends React.PureComponent<{item: IArticle}> {
                              render() {
                                  const {item} = this.props;
                                  const {readOnly} = that.props;
                      Severity: Major
                      Found in scripts/apps/authoring-react/fields/package-items/editor.tsx and 1 other location - About 1 day to fix
                      scripts/apps/authoring-react/fields/linked-items/editor.tsx on lines 26..80

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

                      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 history.js has 797 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*global angular*/
                      
                      /**
                       * @ngdoc overview
                       * @name decipher.history
                      Severity: Major
                      Found in scripts/libs/angular-history/history.js - About 1 day to fix

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

                                render() {
                                    const {runAutomaticallyPreference, vocabularyLabels, showImagesPreference} = this.state;
                        
                                    if (runAutomaticallyPreference === 'loading' || vocabularyLabels == null) {
                                        return null;
                        Severity: Major
                        Found in scripts/extensions/auto-tagging-widget/src/auto-tagging.tsx - About 1 day to fix
                          Severity
                          Category
                          Status
                          Source
                          Language