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

        superdesk
            .activity('/workspace/content', {
                label: gettext('Workspace'),
                priority: 100,
                controller: 'ArchiveListController',
Severity: Major
Found in scripts/apps/archive/index.tsx and 1 other location - About 5 hrs to fix
scripts/apps/archive/index.tsx on lines 88..320

Duplicated Code

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

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

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

Tuning

This issue has a mass of 152.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function DictionaryEditController has 145 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function DictionaryEditController($scope, dictionaries, upload, notify,
    modal, $rootScope, $q) {
    function onSuccess(result) {
        if ($scope.isAbbreviations()) {
            $rootScope.$broadcast('abbreviations:updated', result.content);
Severity: Major
Found in scripts/apps/dictionaries/controllers/DictionaryEditController.ts - About 5 hrs to fix

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

                                return (
                                    <div
                                        key={field.id}
                                        style={{padding: fieldPadding, backgroundColor: '#e6ffe6'}}
                                    >
    scripts/apps/authoring-react/compare-articles/view-difference.tsx on lines 124..144

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

    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

                            return (
                                <div
                                    key={field.id}
                                    style={{padding: fieldPadding, backgroundColor: '#ffe6e6'}}
                                >
    scripts/apps/authoring-react/compare-articles/view-difference.tsx on lines 96..116

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

    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 manage-rundown-templates.tsx has 407 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import * as React from 'react';
    import {
        Button,
        IconButton,
        Tooltip,

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

          render() {
              const {gettext} = superdeskApi.localization;
              const allowedStates = this.props.allowedStates ?? [
                  ASSET_STATE.DRAFT,
                  ASSET_STATE.INTERNAL,
      Severity: Major
      Found in scripts/extensions/sams/src/components/assets/assetEditor.tsx - About 5 hrs to fix

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

                            <div className="time-popup__select-area">
                                <div className="header">Hours</div>
                                <ul>
                                    {this.hours.map((hour, index) => (
                                        <li
        Severity: Major
        Found in scripts/core/ui/components/Form/TimeInput/TimeInputPopup.tsx and 1 other location - About 5 hrs to fix
        scripts/core/ui/components/Form/TimeInput/TimeInputPopup.tsx on lines 122..135

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

        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="time-popup__select-area">
                                <div className="header">Minutes</div>
                                <ul>
                                    {this.minutes.map((minute, index) => (
                                        <li
        Severity: Major
        Found in scripts/core/ui/components/Form/TimeInput/TimeInputPopup.tsx and 1 other location - About 5 hrs to fix
        scripts/core/ui/components/Form/TimeInput/TimeInputPopup.tsx on lines 108..121

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

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

        export function ContentProfilesController($scope: IScope, $location, notify, content, modal, $q) {
            var self = this;
        
            // info bubble
            $scope.showInfoBubble = true;

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

                  render() {
                      const {onChange, save, cancel} = this.props;
                      const item = this.props.item;
                      const {groupAvailableForNewItem} = this.state;
          
          
          Severity: Major
          Found in scripts/extensions/auto-tagging-widget/src/new-item.tsx - About 5 hrs to fix

            Function FilterConditionsController has 141 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function FilterConditionsController($scope, contentFilters, notify, modal, $filter, content) {
                getLabelNameResolver().then((getLabelForFieldId) => {
                    $scope.filterConditions = null;
                    $scope.filterCondition = null;
                    $scope.origFilterCondition = null;

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

                  render() {
                      const {
                          readOnly,
                          locked,
                          showToolbar,
              Severity: Major
              Found in scripts/core/editor3/components/Editor3Component.tsx - About 5 hrs to fix

                Function FamilyService has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function FamilyService(api, desks) {
                    const repo = 'archive,published';
                
                    /**
                     * @ngdoc method
                Severity: Major
                Found in scripts/apps/archive/services/FamilyService.ts - About 5 hrs to fix

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

                      render() {
                          if (this.state.subscribers == null) { // loading
                              return null;
                          }
                  
                  

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

                                    if (!archiveService.isLegal(scope.item)) {
                                        if (scope.item.original_creator) {
                                            userList.getUser(scope.item.original_creator)
                                                .then((user) => {
                                                    scope.originalCreator = user.display_name;
                    Severity: Major
                    Found in scripts/apps/archive/directives/MediaMetadata.ts and 1 other location - About 5 hrs to fix
                    scripts/apps/authoring/metadata/metadata.ts on lines 230..243

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

                    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

                        if (!archiveService.isLegal($scope.item)) {
                            if ($scope.item.original_creator) {
                                userList.getUser($scope.item.original_creator)
                                    .then((user) => {
                                        $scope.originalCreator = user.display_name;
                    Severity: Major
                    Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 5 hrs to fix
                    scripts/apps/archive/directives/MediaMetadata.ts on lines 38..51

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

                    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 MetadataCtrl has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function MetadataCtrl(
                        $scope, desks, metadata, privileges, datetimeHelper, userList,
                        preferencesService, archiveService, moment, content) {
                        desks.initialize();
                    
                    
                    Severity: Minor
                    Found in scripts/apps/authoring/metadata/metadata.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

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

                        render() {
                            const {gettext} = superdeskApi.localization;
                            const {currentDestination} = this.props;
                            const destinations = this.props.destinations ?? [];
                            const {updates} = this.state;
                    Severity: Major
                    Found in scripts/extensions/sams/src/components/sets/setEditorPanel.tsx - About 5 hrs to fix

                      Function VirtualListComponent has 138 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function VirtualListComponent<T>(props: IProps<T>, ref: React.Ref<IExposedFromVirtualList>) {
                          const {totalItemsCount, loadItems, itemTemplate, width, height, initialItems} = props;
                          const parentRef = React.useRef();
                      
                          const rowVirtualizer = useVirtual({
                      Severity: Major
                      Found in scripts/core/ui/components/virtual-lists/virtual-list.tsx - About 5 hrs to fix

                        File page.tsx has 396 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import * as React from 'react';
                        import {noop} from 'lodash';
                        import * as Layout from 'superdesk-ui-framework/react/components/Layouts';
                        
                        import {
                        Severity: Minor
                        Found in scripts/extensions/broadcasting/src/page.tsx - About 5 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language