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>
                        <Button
                            text={gettext('Print')}
                            icon="print"
                            iconOnly
Severity: Major
Found in scripts/apps/authoring-react/preview-article-modal.tsx and 1 other location - About 3 hrs to fix
scripts/apps/authoring/preview/fullPreviewMultiple.tsx on lines 55..75

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

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>
                            <Button
                                text={gettext('Print')}
                                icon="print"
                                iconOnly
Severity: Major
Found in scripts/apps/authoring/preview/fullPreviewMultiple.tsx and 1 other location - About 3 hrs to fix
scripts/apps/authoring-react/preview-article-modal.tsx on lines 22..42

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

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

import * as React from 'react';

import {WithSizeObserver, ContentListItem, Label, IconButton, Menu, Alert} from 'superdesk-ui-framework/react';
import {IRundown, IRundownFilters, IRundownItem, IRundownTemplate, IShow} from '../interfaces';

Severity: Minor
Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx - About 3 hrs to fix

    File DesksFactory.ts has 327 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import _ from 'lodash';
    import {gettext} from 'core/utils';
    import {IDesk} from 'superdesk-api';
    import {logger} from 'core/services/logger';
    import {dispatchCustomEvent} from 'core/get-superdesk-api-implementation';
    Severity: Minor
    Found in scripts/apps/desks/services/DesksFactory.ts - About 3 hrs to fix

      Function SearchWidgetCtrl has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function SearchWidgetCtrl($scope, packages: IPackagesService, api, search) {
          $scope.selected = null;
          $scope.multiSelected = [];
          $scope.query = null;
          $scope.highlight = null;
      Severity: Major
      Found in scripts/apps/packaging/controllers/SearchWidgetCtrl.ts - About 3 hrs to fix

        Function getPlaceAdapter has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function getPlaceAdapter(): IFieldAdapter<IArticle> {
            const useGeoNamesApi = sdApi.config.featureEnabled('places_autocomplete');
        
            if (useGeoNamesApi) {
                return {
        Severity: Major
        Found in scripts/apps/authoring-react/field-adapters/place.ts - About 3 hrs to fix

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

              render() {
                  const planningComponents = [IMasterDeskTab.assignments];
          
                  const tabs = Object.values(IMasterDeskTab).filter((tab) =>
                      this.props.isPlaningActive ? tab : !planningComponents.includes(tab),
          Severity: Major
          Found in scripts/apps/master-desk/components/HeaderComponent.tsx - About 3 hrs to fix

            File ArticleEditDirective.ts has 326 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import _ from 'lodash';
            import {IArticle} from 'superdesk-api';
            import {FIELD_KEY_SEPARATOR} from 'core/editor3/helpers/fieldsMeta';
            import {getLabelNameResolver} from 'apps/workspace/helpers/getLabelForFieldId';
            import {getMediaTypes} from 'apps/vocabularies/constants';
            Severity: Minor
            Found in scripts/apps/authoring/authoring/directives/ArticleEditDirective.ts - About 3 hrs to fix

              Function PieChartDashboard has 95 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function PieChartDashboard(colorSchemes) {
                  return {
                      replace: true,
                      scope: {
                          terms: '=',
              Severity: Major
              Found in scripts/apps/ingest/directives/PieChartDashboard.ts - About 3 hrs to fix

                Function ItemAssociationDirective has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function ItemAssociationDirective(renditions, notify) {
                    return {
                        scope: {
                            rel: '=',
                            fieldName: '=',

                  Function ItemGlobalSearch has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function ItemGlobalSearch(
                      session, api, notify, keyboardManager, asset, authoringWorkspace: AuthoringWorkspaceService, authoring,
                  ) {
                      return {
                          scope: {repo: '=', context: '='},
                  Severity: Major
                  Found in scripts/apps/search/directives/ItemGlobalSearch.ts - About 3 hrs to fix

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

                                link: function(scope, element, attrs) {
                                    scope.features = features;
                                    scope.changePassword = false;
                    
                                    scope.methods = {
                    Severity: Major
                    Found in scripts/core/auth/login-modal-directive.ts - About 3 hrs to fix

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

                      function handleUnsavedRundownChanges(
                          mode: IRundownItemActionNext,
                          skipUnsavedChangesCheck: boolean,
                          onSuccess: () => void,
                      ) {
                      scripts/extensions/broadcasting/src/utils/handle-unsaved-rundown-changes.ts on lines 7..29

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 111.

                      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

                      export function handleUnsavedRundownChanges(
                          mode: ICreate | IEdit | IPreview | null,
                          skipUnsavedChangesCheck: boolean,
                          onSuccess: () => void,
                      ) {
                      scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx on lines 74..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 111.

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

                      import * as React from 'react';
                      import {IArticle, ISuperdesk} from 'superdesk-api';
                      import {IErrorMessage, ICrop, IVideoProject} from './interfaces';
                      import {pick} from 'lodash';
                      
                      
                      Severity: Minor
                      Found in scripts/extensions/videoEditor/src/VideoEditorThumbnail.tsx - About 3 hrs to fix

                        Function confirmSendingPackages has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function confirmSendingPackages(items: Array<IArticle>): Promise<void> {
                            const packages = items.filter(({type}) => type === 'composite');
                        
                            if (packages.length < 1) {
                                return Promise.resolve();
                        Severity: Major
                        Found in scripts/api/article-send.tsx - About 3 hrs to fix

                          Function UserSelectList has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function UserSelectList($filter, api) {
                              return {
                                  scope: {
                                      exclude: '=?',
                                      onchoose: '&',
                          Severity: Major
                          Found in scripts/apps/desks/directives/UserSelectList.ts - About 3 hrs to fix

                            Function AuthoringThemesService has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function AuthoringThemesService(storage, preferencesService) {
                                var service: any = {};
                            
                                service.availableThemes = {
                                    fonts: [
                            Severity: Major
                            Found in scripts/apps/authoring/authoring/services/AuthoringThemesService.ts - About 3 hrs to fix

                              File setEditorPanel.tsx has 323 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              // External Modules
                              import * as React from 'react';
                              import {connect} from 'react-redux';
                              import {Dispatch} from 'redux';
                              import {cloneDeep, isEqual} from 'lodash';
                              Severity: Minor
                              Found in scripts/extensions/sams/src/components/sets/setEditorPanel.tsx - About 3 hrs to fix

                                Function IngestRoutingAction has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                                Open

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

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Severity
                                Category
                                Status
                                Source
                                Language