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

        const values2: Array<IDropdownOption> =
            (() => {
                if (value2 == null) {
                    return [];
                } else if (Array.isArray(value2)) {
scripts/apps/authoring-react/fields/dropdown/dropdown-manual-entry/difference.tsx on lines 13..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 102.

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>
                    <Checkbox
                        label={{text: gettext('Allow adding items that are in progress')}}
                        checked={config.allowedWorkflows.inProgress}
                        onChange={(val) => {
Severity: Major
Found in scripts/apps/authoring-react/fields/media/config.tsx and 1 other location - About 3 hrs to fix
scripts/apps/authoring-react/fields/media/config.tsx on lines 92..106

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

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

                    {has('comments') && (
                        <SelectionButton
                            onClick={showPopup(PopupTypes.Comment)}
                            precondition={
                                this.props.highlightsManager.canAddHighlight(getHighlightsConfig().COMMENT.type)
Severity: Major
Found in scripts/core/editor3/components/toolbar/index.tsx and 1 other location - About 3 hrs to fix
scripts/core/editor3/components/toolbar/index.tsx on lines 279..290

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

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

import React from 'react';
import PropTypes from 'prop-types';
import {Dropdown, NavTabs} from 'core/ui/components';
import {connect} from 'react-redux';

Severity: Minor
Found in scripts/core/editor3/components/annotations/AnnotationInput.tsx - About 3 hrs to fix

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

        constructor(props: IProps) {
            super(props);
    
            this.state = {
                showId: props.initialShow?.id ?? null,

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

          render() {
              const config = getConfigWithDefaults(this.props.config);
              const {onChange} = this.props;
      
              return (
      Severity: Major
      Found in scripts/extensions/datetimeField/src/config.tsx - About 3 hrs to fix

        Function IngestRoutingAction has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function IngestRoutingAction(desks, macros, subscribersService, metadata) {
            return {
                scope: {
                    rule: '=',
                    ruleHandler: '=',
        Severity: Major
        Found in scripts/apps/ingest/directives/IngestRoutingAction.ts - About 3 hrs to fix

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

                  link: function(scope, elem, attrs, dropdown) {
                      scope.$watch(dropdown.isOpen, (isOpen) => {
                          var inputField = elem.find('input[type="text"]');
          
                          if (isOpen) {
          Severity: Major
          Found in scripts/core/ui/ui.ts - About 3 hrs to fix

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

                render() {
                    const {comment} = this.props;
                    const {data} = comment;
                    const {replies, resolutionInfo} = data;
                    const isAuthor = data.email === this.currentUser;
            Severity: Major
            Found in scripts/core/editor3/components/comments/CommentPopup.tsx - About 3 hrs to fix

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

                  constructor() {
                      /** List of content profiles on settings page **/
                      this.list = element.all(by.repeater('type in ctrl.items'));
              
                      /**
              Severity: Major
              Found in e2e/client/specs/helpers/content_profiles.ts - About 3 hrs to fix

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

                                        } else if (item.operation === 'mark' && item.update.desk_id !== null) {
                                            return (
                                                <BaseHistoryItem items={historyItems} current={i} key={i}>
                                                    <div>
                                                        {gettext(
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 281..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 298..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 332..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 376..548

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

                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 5 locations. Consider refactoring.
                Open

                                        } else if (item.operation === 'mark' && item.update.highlight_id !== null) {
                                            return (
                                                <BaseHistoryItem items={historyItems} current={i} key={i}>
                                                    <div>
                                                        {gettext(
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 298..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 315..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 332..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 376..548

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

                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 5 locations. Consider refactoring.
                Open

                                        } else if (item.operation === 'unmark' && item.update.desk_id !== null) {
                                            return (
                                                <BaseHistoryItem items={historyItems} current={i} key={i}>
                                                    <div>
                                                        {gettext(
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 281..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 298..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 315..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 376..548

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

                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 5 locations. Consider refactoring.
                Open

                                        } else if (item.operation === 'unmark' && item.update.highlight_id !== null) {
                                            return (
                                                <BaseHistoryItem items={historyItems} current={i} key={i}>
                                                    <div>
                                                        {gettext(
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 281..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 315..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 332..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 376..548

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

                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

                interface IProps {
                    container: React.ComponentType<IEditorComponentContainerProps>;
                    config: IDropdownConfigVocabulary;
                    value: IDropdownValue;
                    language: string;
                scripts/apps/authoring-react/fields/dropdown/dropdown-manual-entry/editor.tsx on lines 11..19

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

                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

                    getContentPanelComponent(): React.ComponentType<any> | null {
                        if (this.props.contentPanelState === CONTENT_PANEL_STATE.PREVIEW) {
                            return SetPreviewPanel;
                        } else if (
                            this.props.contentPanelState === CONTENT_PANEL_STATE.CREATE ||
                scripts/extensions/sams/src/apps/samsWorkspace.tsx on lines 217..227

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

                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

                interface IProps {
                    container: React.ComponentType<IEditorComponentContainerProps>;
                    config: IDropdownConfigManualSource;
                    value: IDropdownValue;
                    language: string;
                scripts/apps/authoring-react/fields/dropdown/dropdown-vocabulary/editor.tsx on lines 11..19

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

                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

                    getContentPanelComponent(): React.ComponentType<any> | null {
                        if (this.props.contentPanelState === ASSET_CONTENT_PANEL_STATE.PREVIEW) {
                            return AssetPreviewPanel;
                        } else if (
                            this.props.contentPanelState === ASSET_CONTENT_PANEL_STATE.CREATE ||
                Severity: Major
                Found in scripts/extensions/sams/src/apps/samsWorkspace.tsx and 1 other location - About 3 hrs to fix
                scripts/extensions/sams/src/components/sets/manageSetsModal.tsx on lines 65..76

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

                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

                            scope.setSearchInfo = function(_id) {
                                var item = scope.editGroups[_id];
                
                                if (!item.type) {
                                    item._id = _id;
                Severity: Major
                Found in scripts/apps/monitoring/directives/AggregateSettings.ts and 1 other location - About 3 hrs to fix
                scripts/apps/monitoring/directives/AggregateSettings.ts on lines 151..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 101.

                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 5 locations. Consider refactoring.
                Open

                                        } else if (item.operation === 'create_highlight' && item.update.highlight_id != null) {
                                            return (
                                                <BaseHistoryItem items={historyItems} current={i} key={i}>
                                                    <div>
                                                        {gettext(
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 281..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 298..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 315..548
                scripts/apps/authoring-react/article-widgets/versions-and-item-history/history-tab.tsx on lines 332..548

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

                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