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

                        <div className="form__row">
                            <div className="sd-input">
                                <label
                                    className="sd-input__label"
                                    htmlFor="at-name"
Severity: Major
Found in scripts/extensions/auto-tagging-widget/src/new-item.tsx and 1 other location - About 5 hrs to fix
scripts/extensions/auto-tagging-widget/src/new-item.tsx on lines 152..174

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

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 className="form__row">
                            <div className="sd-input">
                                <label
                                    className="sd-input__label"
                                    htmlFor="at-description"
Severity: Major
Found in scripts/extensions/auto-tagging-widget/src/new-item.tsx and 1 other location - About 5 hrs to fix
scripts/extensions/auto-tagging-widget/src/new-item.tsx on lines 83..105

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

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 ui-framework-authoring-test.tsx has 387 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable max-len */
import * as React from 'react';
import * as Layout from 'superdesk-ui-framework/react/components/Layouts';
import * as Form from 'superdesk-ui-framework/react/components/Form';
import * as Nav from 'superdesk-ui-framework/react/components/Navigation';
Severity: Minor
Found in scripts/apps/authoring-react/ui-framework-authoring-test.tsx - About 5 hrs to fix

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

        render() {
            if (this.state.versions === 'loading') {
                return null;
            }
    
    

      Function getHighlightsConfig has 132 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getHighlightsConfig() {
          return {
              COMMENT: {
                  type: 'COMMENT',
                  description: gettext('Comment'),
      Severity: Major
      Found in scripts/core/editor3/highlightsConfig.ts - About 5 hrs to fix

        Function MultiImageEditController has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

        export function MultiImageEditController(
            $scope: IScope,
            modal,
            notify,
            lock,
        Severity: Minor
        Found in scripts/apps/search/MultiImageEdit.ts - About 5 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

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

                        if (errors.length < 1) {
                            notify.success(gettext('All items were published successfully.'));
                            unselectAll();
                        } else {
                            errors.forEach((err) => {
        Severity: Major
        Found in scripts/apps/search/controllers/get-multi-actions.tsx and 1 other location - About 5 hrs to fix
        scripts/apps/search/controllers/get-multi-actions.tsx on lines 370..384

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

        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

                        if (errors.length === 0) {
                            notify.success(gettext('{{count}} articles have been descheduled', {count: success.length}));
                        } else {
                            errors.forEach((err) => {
                                let messages = null;
        Severity: Major
        Found in scripts/apps/search/controllers/get-multi-actions.tsx and 1 other location - About 5 hrs to fix
        scripts/apps/search/controllers/get-multi-actions.tsx on lines 327..342

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

        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

            constructor(props) {
                super(props);
        
                this.handleClickOutside = this.handleClickOutside.bind(this);
                this.handleKeydown = this.handleKeydown.bind(this);
        Severity: Major
        Found in scripts/core/ui/components/Popup/Popup.tsx and 1 other location - About 5 hrs to fix
        scripts/apps/contacts/components/Popup/Popup.tsx on lines 20..35

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

        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

                        <Component
                            key={index}
                            index={index}
                            field={`${field}[${index}]`}
                            onChange={onChange}
        Severity: Major
        Found in scripts/core/ui/components/Form/InputArray/index.tsx and 1 other location - About 5 hrs to fix
        scripts/core/ui/components/Form/InputArray/index.tsx on lines 84..96

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

        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

            var _getAllIngestProviders = function(criteria = {}, page = 1, providers = []) {
                return api.query('ingest_providers', _.extend({max_results: 200, page: page}, criteria))
                    .then((result) => {
                        let pg = page;
                        let merged = providers.concat(result._items);
        Severity: Major
        Found in scripts/apps/ingest/services/IngestProviderService.ts and 1 other location - About 5 hrs to fix
        scripts/apps/publish/services/SubscribersService.ts on lines 10..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 140.

        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

                        <Component
                            key={index}
                            index={index}
                            field={`${field}[${index}]`}
                            onChange={onChange}
        Severity: Major
        Found in scripts/core/ui/components/Form/InputArray/index.tsx and 1 other location - About 5 hrs to fix
        scripts/core/ui/components/Form/InputArray/index.tsx on lines 69..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 140.

        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

            var _getAllSubscribers = function(criteria = {}, page = 1, subscribers = []) {
                return api.query('subscribers', _.extend({max_results: 200, page: page}, criteria))
                    .then((result) => {
                        let pg = page;
                        let merged = subscribers.concat(result._items);
        Severity: Major
        Found in scripts/apps/publish/services/SubscribersService.ts and 1 other location - About 5 hrs to fix
        scripts/apps/ingest/services/IngestProviderService.ts on lines 6..18

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

        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

            constructor(props) {
                super(props);
        
                this.handleClickOutside = this.handleClickOutside.bind(this);
                this.handleKeydown = this.handleKeydown.bind(this);
        Severity: Major
        Found in scripts/apps/contacts/components/Popup/Popup.tsx and 1 other location - About 5 hrs to fix
        scripts/core/ui/components/Popup/Popup.tsx on lines 21..36

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

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

        export function getMarkForUserModal(options: {
            superdesk: ISuperdesk,
            markForUser: (markedForUserId: string | null) => void,
            markForUserAndSend: (markedForUserId: string | null) => void,
            locked: boolean;
        Severity: Major
        Found in scripts/extensions/markForUser/src/get-mark-for-user-modal.tsx - About 5 hrs to fix

          Function VocabularyConfigController has 131 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function VocabularyConfigController($scope: IScope, $route, $routeParams, vocabularies, $rootScope,
              api, notify, modal, session) {
              $scope.loading = true;
              $scope.mediaTypes = getMediaTypes();
          
          
          Severity: Major
          Found in scripts/apps/vocabularies/controllers/VocabularyConfigController.ts - About 5 hrs to fix

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

                constructor() {
                    this.sideMenu = element(by.id('side-menu'));
                    function openContent() {
                        return nav('workspace/content');
                    }
            Severity: Major
            Found in e2e/client/specs/helpers/workspace.ts - About 5 hrs to fix

              Function getMarkedForMeComponent has 130 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function getMarkedForMeComponent(superdesk: ISuperdesk) {
                  const {Badge, GroupLabel, TopMenuDropdownButton} = superdesk.components;
              
                  return class MarkedForMe extends React.PureComponent<{}, IState> {
                      private removeMarkedListener: () => void;
              Severity: Major
              Found in scripts/extensions/markForUser/src/get-marked-for-me-component.tsx - About 5 hrs to fix

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

                        link: function(scope) {
                            let _orig = null, _origRule = null, _new = false;
                
                            scope.editScheme = null;
                            scope.selectedRule = null;
                Severity: Major
                Found in scripts/apps/ingest/directives/IngestRoutingContent.ts - About 5 hrs to fix

                  Function HttpEndpointFactory has 130 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function HttpEndpointFactory($http, $q, urls, _) {
                      /**
                       * @ngdoc method
                       * @name HttpEndpointFactory#getUrl
                       * @private
                  Severity: Major
                  Found in scripts/core/api/http-endpoint-factory.ts - About 5 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language