superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

    componentDidMount() {
        document.addEventListener('keydown', this.handleKeydown);
        document.addEventListener('click', this.handleClickOutside);

        if (this.dom.root) {
Severity: Major
Found in scripts/core/ui/components/Popup/Popup.tsx and 1 other location - About 4 days to fix
scripts/apps/contacts/components/Popup/Popup.tsx on lines 37..100

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

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

    componentDidMount() {
        document.addEventListener('keydown', this.handleKeydown);
        document.addEventListener('click', this.handleClickOutside);

        if (this.dom.root) {
Severity: Major
Found in scripts/apps/contacts/components/Popup/Popup.tsx and 1 other location - About 4 days to fix
scripts/core/ui/components/Popup/Popup.tsx on lines 38..101

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

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

export function AuthoringDirective(
    superdesk,
    authoringWorkspace: AuthoringWorkspaceService,
    notify,
    desks,
Severity: Minor
Found in scripts/apps/authoring/authoring/directives/AuthoringDirective.ts - About 4 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 AuthoringDirective has 742 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function AuthoringDirective(
    superdesk,
    authoringWorkspace: AuthoringWorkspaceService,
    notify,
    desks,
Severity: Major
Found in scripts/apps/authoring/authoring/directives/AuthoringDirective.ts - About 3 days to fix

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

            link: function($scope, elem, attrs) {
                $scope.loading = false;
                $scope.tabsPinned = false;
    
                var _closing;
    Severity: Major
    Found in scripts/apps/authoring/authoring/directives/AuthoringDirective.ts - About 3 days to fix

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

          constructor() {
              this.lock = element(by.css('[ng-click="lock()"]'));
              this.correct_button = element(by.buttonText('correct'));
              this.kill_button = element(by.buttonText('kill'));
              this.close_button = element(by.buttonText('Close'));
      Severity: Major
      Found in e2e/client/specs/helpers/authoring.ts - About 3 days to fix

        Function SearchService has a Cognitive Complexity of 155 (exceeds 5 allowed). Consider refactoring.
        Open

        export function SearchService($location, session, multi,
            preferencesService, moment, sortService) {
            const PARAMETERS = getParameters();
            const EXCLUDE_FACETS = getExcludeFacets();
        
        
        Severity: Minor
        Found in scripts/apps/search/services/SearchService.ts - About 3 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 getInlineToolbarActions has 630 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getInlineToolbarActions(
            options: IExposedFromAuthoring<IArticle>,
            action?: IAuthoringActionType,
        ): IAuthoringOptions<IArticle> {
            const {
        Severity: Major
        Found in scripts/apps/authoring-react/authoring-angular-integration.tsx - About 3 days to fix

          File authoring-react.tsx has 1195 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          import {
              IArticle,
              IAuthoringFieldV2,
              IContentProfileV2,
          Severity: Major
          Found in scripts/apps/authoring-react/authoring-react.tsx - About 3 days to fix

            File metadata.ts has 1148 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import _ from 'lodash';
            import PreferedCvItemsConfigDirective from './PreferedCvItemsConfigDirective';
            import MetaPlaceDirective from './MetaPlaceDirective';
            import {getVocabularySelectionTypes} from '../../vocabularies/constants';
            import {gettext} from 'core/utils';
            Severity: Major
            Found in scripts/apps/authoring/metadata/metadata.ts - About 2 days to fix

              Function getAutoTaggingComponent has 572 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function getAutoTaggingComponent(superdesk: ISuperdesk, label: string) {
                  const {preferences} = superdesk;
                  const {httpRequestJsonLocal} = superdesk;
                  const {gettext, gettextPlural} = superdesk.localization;
                  const {memoize, generatePatch, arrayToTree} = superdesk.utilities;
              Severity: Major
              Found in scripts/extensions/auto-tagging-widget/src/auto-tagging.tsx - About 2 days to fix

                Function MonitoringGroup has a Cognitive Complexity of 139 (exceeds 5 allowed). Consider refactoring.
                Open

                export function MonitoringGroup(
                    cards,
                    api,
                    authoringWorkspace: AuthoringWorkspaceService,
                    $timeout,
                Severity: Minor
                Found in scripts/apps/monitoring/directives/MonitoringGroup.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 AuthoringService has 557 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function AuthoringService(
                    $q,
                    $location,
                    api,
                    lock,
                Severity: Major
                Found in scripts/apps/authoring/authoring/services/AuthoringService.ts - About 2 days to fix

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

                      constructor() {
                          this.config = element(by.className('aggregate-settings'));
                          this.label = element(by.model('widget.configuration.label'));
                  
                          this.openMonitoring = function() {
                  Severity: Major
                  Found in e2e/client/specs/helpers/monitoring.ts - About 2 days to fix

                    Function IngestSourcesContent has 520 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function IngestSourcesContent(ingestSources, api, $location,
                        modal, $filter, privileges) {
                        return {
                            templateUrl: 'scripts/apps/ingest/views/settings/ingest-sources-content.html',
                            link: function($scope) {
                    Severity: Major
                    Found in scripts/apps/ingest/directives/IngestSourcesContent.ts - About 2 days to fix

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

                              link: function($scope) {
                                  $scope.waitForDirectiveReady = function() {
                                      return Promise.all([
                                          ingestSources.fetchAllFeedingServicesAllowed(),
                                      ]);
                      Severity: Major
                      Found in scripts/apps/ingest/directives/IngestSourcesContent.ts - About 2 days to fix

                        File ui.ts has 999 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /* eslint-disable max-len */
                        /* tslint:disable:max-line-length */
                        
                        import _, {difference, filter, mapValues, sortBy, union, without} from 'lodash';
                        import moment from 'moment-timezone';
                        Severity: Major
                        Found in scripts/core/ui/ui.ts - About 2 days to fix

                          File monitoring_spec.ts has 997 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /* eslint-disable newline-per-chained-call */
                          
                          import {element, browser, by, protractor, ElementFinder} from 'protractor';
                          
                          import {monitoring} from './helpers/monitoring';
                          Severity: Major
                          Found in e2e/client/specs/monitoring_spec.ts - About 2 days to fix

                            Function SearchService has 498 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function SearchService($location, session, multi,
                                preferencesService, moment, sortService) {
                                const PARAMETERS = getParameters();
                                const EXCLUDE_FACETS = getExcludeFacets();
                            
                            
                            Severity: Major
                            Found in scripts/apps/search/services/SearchService.ts - About 2 days to fix

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

                              export const genre: IFieldAdapter<IArticle> = {
                                  getFieldV2: (fieldEditor, fieldSchema) => {
                                      const multiple = isMultipleV2('genre');
                              
                                      const fieldConfig: IDropdownConfigVocabulary = {
                              Severity: Major
                              Found in scripts/apps/authoring-react/field-adapters/genre.ts and 1 other location - About 2 days to fix
                              scripts/apps/authoring-react/field-adapters/place.ts on lines 70..125

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language