superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

        link: function(scope, element, attrs) {
            const userLang = getUserInterfaceLanguage().replace('_', '-');
            const body = angular.element('body');

            scope.activeNavigation = null;
Severity: Major
Found in scripts/apps/users/directives/UserPreferencesDirective.ts - About 1 day to fix

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

            link: function(scope, elem) {
                // origUser is set by parent scope when selecting users from GUI
                // but it also needs to be updated before editing so dirtiness can be computed correctly
                // according to the latest data on the server
                let clearOrigUserWatcher = noop;
    Severity: Major
    Found in scripts/apps/users/directives/UserEditDirective.ts - About 1 day to fix

      Function AuthoringHeaderDirective has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
      Open

      export function AuthoringHeaderDirective(
          api,
          authoringWidgets,
          $rootScope,
          archiveService,

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

      export function RelatedItemsDirective(
          authoringWorkspace: AuthoringWorkspaceService,
          relationsService,
          notify,
          lock,
      Severity: Major
      Found in scripts/apps/relations/directives/RelatedItemsDirective.ts - About 1 day to fix

        Function MetadataService has 216 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function MetadataService(api, subscribersService, vocabularies, $rootScope, session, $filter) {
            var service = {
                values: {},
                helper_text: {},
                popup_width: {},
        Severity: Major
        Found in scripts/apps/authoring/metadata/metadata.ts - About 1 day to fix

          File authoring_spec.ts has 523 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* eslint-disable newline-per-chained-call */
          
          import {element, by, protractor, browser} from 'protractor';
          import {
              ctrlKey,
          Severity: Major
          Found in e2e/client/specs/authoring_spec.ts - About 1 day to fix

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

                                    <ListItemActionsMenu>
                                        <div style={{display: 'flex'}}>
                                            <button
                                                onClick={(e) => {
                                                    e.stopPropagation();
            Severity: Major
            Found in scripts/extensions/broadcasting/src/shows/manage-shows.tsx and 2 other locations - About 1 day to fix
            scripts/apps/system-messages/components/system-messages-settings.tsx on lines 110..134
            scripts/extensions/annotationsLibrary/src/annotations-library-page.tsx on lines 62..86

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

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

                                        <ListItemActionsMenu>
                                            <div style={{display: 'flex'}}>
                                                <button
                                                    onClick={(e) => {
                                                        e.stopPropagation();
            scripts/apps/system-messages/components/system-messages-settings.tsx on lines 110..134
            scripts/extensions/broadcasting/src/shows/manage-shows.tsx on lines 81..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 206.

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

                            <ListItemActionsMenu>
                                <div style={{display: 'flex'}}>
                                    <button
                                        onClick={(e) => {
                                            e.stopPropagation();
            scripts/extensions/broadcasting/src/shows/manage-shows.tsx on lines 81..105
            scripts/extensions/annotationsLibrary/src/annotations-library-page.tsx on lines 62..86

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

            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 article.ts has 519 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {sdApi} from 'api';
            import {appConfig, extensions} from 'appConfig';
            import {ITEM_STATE, KILLED_STATES, PUBLISHED_STATES} from 'apps/archive/constants';
            import {applicationState, openArticle} from 'core/get-superdesk-api-implementation';
            import {dataApi} from 'core/helpers/CrudManager';
            Severity: Major
            Found in scripts/api/article.ts - About 1 day to fix

              File history-tab.tsx has 519 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import {Map} from 'immutable';
              import {IExtensionActivationResult, IRestApiResponse} from 'superdesk-api';
              import {getHistoryItems, IHistoryItem, getOperationLabel} from 'apps/authoring/versioning/history/HistoryController';
              import {TimeElem} from 'apps/search/components';

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

                export const scrollListItemIfNeeded = (selectedIndex, listRefElement) => {
                    if (listRefElement.children.length > 0) {
                        let activeElement = listRefElement.children[selectedIndex];
                
                        if (activeElement) {
                Severity: Major
                Found in scripts/apps/contacts/helpers.ts and 1 other location - About 1 day to fix
                scripts/core/ui/components/utils.ts on lines 24..43

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

                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

                export const scrollListItemIfNeeded = (selectedIndex, listRefElement) => {
                    if (listRefElement.children.length > 0) {
                        const activeElement = listRefElement.children[selectedIndex];
                
                        if (activeElement) {
                Severity: Major
                Found in scripts/core/ui/components/utils.ts and 1 other location - About 1 day to fix
                scripts/apps/contacts/helpers.ts on lines 131..150

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

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

                    render() {
                        const {languages} = this.state;
                
                        if (languages == null) {
                            return null;
                Severity: Major
                Found in scripts/apps/vocabularies/components/VocabularyItemsViewEdit.tsx - About 1 day to fix

                  Function APIProvider has 211 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function APIProvider() {
                      var apis = {};
                  
                      /**
                       * @ngdoc method
                  Severity: Major
                  Found in scripts/core/api/api-service.ts - About 1 day to fix

                    Function PublishQueueController has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function PublishQueueController($scope, subscribersService, api, $q, notify, $location, ingestSources,
                        vocabularies) {
                        $scope.subscribers = null;
                        $scope.subscriberLookup = {};
                        $scope.ingestProviders = null;
                    Severity: Minor
                    Found in scripts/apps/publish/controllers/PublishQueueController.ts - About 1 day 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 constructor has 210 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        constructor() {
                            /** List of desks on desk settings list **/
                            this.list = element.all(by.repeater('desk in desks._items'));
                            /** For an item from desks settings list, get his name **/
                            this.name = element(by.model('desk.name'));
                    Severity: Major
                    Found in e2e/client/specs/helpers/desks.ts - About 1 day to fix

                      Function MultiImageEditController has 209 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function MultiImageEditController(
                          $scope: IScope,
                          modal,
                          notify,
                          lock,
                      Severity: Major
                      Found in scripts/apps/search/MultiImageEdit.ts - About 1 day to fix

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

                        export function unlockAsset(original: IAssetItem, updates: Dictionary<string, any>): Promise<Partial<IAssetItem>> {
                            const {gettext} = superdeskApi.localization;
                            const {notify} = superdeskApi.ui;
                        
                            return superdeskApi.dataApi.patch<IAssetItem>(UNLOCK_ASSET, original, updates)
                        Severity: Major
                        Found in scripts/extensions/sams/src/api/assets.ts and 1 other location - About 1 day to fix
                        scripts/extensions/sams/src/api/assets.ts on lines 592..609

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

                        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

                        export function lockAsset(original: IAssetItem, updates: Dictionary<string, any>): Promise<Partial<IAssetItem>> {
                            const {gettext} = superdeskApi.localization;
                            const {notify} = superdeskApi.ui;
                        
                            return superdeskApi.dataApi.patch<IAssetItem>(LOCK_ASSET, original, updates)
                        Severity: Major
                        Found in scripts/extensions/sams/src/api/assets.ts and 1 other location - About 1 day to fix
                        scripts/extensions/sams/src/api/assets.ts on lines 611..628

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

                        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