superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function bindEvents has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var bindEvents = function() {
        ws.onmessage = function(event) {
            var msg = angular.fromJson(event.data);

            // Delay all websocket events to avoid getting old data.
Severity: Minor
Found in scripts/core/notification/notification.ts - About 1 hr to fix

    Function debounceAsync has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function debounceAsync<T>(
        fn: (abortController: AbortController) => Promise<T>,
        timeout: number, // in miliseconds
        maxWait?, // in miliseconds, must be >= timeout
    ): IDebounced {
    Severity: Minor
    Found in scripts/core/helpers/debounce-async.ts - About 1 hr to fix

      Function keyBindingFn has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          keyBindingFn(e) {
              const {key, shiftKey, ctrlKey, metaKey} = e;
              const selectionState = this.props.editorState.getSelection();
              const modifierKey = isMacOS() ? metaKey : ctrlKey;
      
      
      Severity: Minor
      Found in scripts/core/editor3/components/Editor3Component.tsx - About 1 hr to fix

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

            checkIfIsNotEmpty(): boolean {
                return Object.keys(this.props.filters).some((item: any) =>
                    this.props.filters[item] && this.props.filters[item].length);
            }
        Severity: Major
        Found in scripts/apps/master-desk/components/FilterBarComponent.tsx and 1 other location - About 1 hr to fix
        scripts/apps/master-desk/components/OverviewComponent.tsx on lines 108..111

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

        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

            hasFilters() {
                return Object.keys(this.props.filters).some((item: any) =>
                    this.props.filters[item] && this.props.filters[item].length);
            }
        Severity: Major
        Found in scripts/apps/master-desk/components/OverviewComponent.tsx and 1 other location - About 1 hr to fix
        scripts/apps/master-desk/components/FilterBarComponent.tsx on lines 13..16

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

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

            constructor() {
                var daysButonsBox = $('.day-filter-box');
        
                this.saveBtn = element(by.buttonText('Save'));
        
        
        Severity: Minor
        Found in e2e/client/specs/helpers/pages.ts - About 1 hr to fix

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

                  this.addPersonalDictionary = function() {
                      element(by.css('[data-sd-tooltip="Add new"]')).click();
                      element(by.id('createPersonalDictionary')).click();
                      browser.sleep(100);
                  };
          Severity: Major
          Found in e2e/client/specs/helpers/dictionaries.ts and 1 other location - About 1 hr to fix
          e2e/client/specs/helpers/dictionaries.ts on lines 87..91

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

          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 (this.props.closeOnHoverEnd && this.wrapperEl != null) {
                      this.props.referenceElement.removeEventListener('mouseleave', this.closeOnMouseLeave);
                      this.wrapperEl.removeEventListener('mouseleave', this.closeOnMouseLeave);
                  }
          Severity: Major
          Found in scripts/core/ui/components/popupNew.tsx and 1 other location - About 1 hr to fix
          scripts/core/ui/components/popupNew.tsx on lines 65..68

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

          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 (key === 'categories:preferred') {
                                  val.selected = {};
                                  scope.categories.forEach((cat) => {
                                      val.selected[cat.qcode] = !!cat.selected;
                                  });
          Severity: Major
          Found in scripts/apps/users/directives/UserPreferencesDirective.ts and 1 other location - About 1 hr to fix
          scripts/apps/users/directives/UserPreferencesDirective.ts on lines 414..419

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

          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 (multiActions.canPublishItem()) {
                          actions.push({
                              label: gettext('Publish'),
                              icon: 'icon-ok',
                              onTrigger: () => {
          Severity: Major
          Found in scripts/apps/search/controllers/get-bulk-actions.tsx and 1 other location - About 1 hr to fix
          scripts/apps/search/controllers/get-bulk-actions.tsx on lines 57..67

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

          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 {
              items: Array<IArticle>;
              closeSendToView(): void;
              markupV2: boolean;
              handleUnsavedChanges(items: Array<IArticle>): Promise<Array<IArticle>>;
          scripts/core/interactive-article-actions-panel/actions/fetch-to-tab.tsx on lines 15..20

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

          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 getAssetSearchResults = createSelector<
              IApplicationState,
              Array<string>,
              Dictionary<string, IAssetItem>,
              Array<IAssetItem>
          Severity: Major
          Found in scripts/extensions/sams/src/store/assets/selectors.ts and 1 other location - About 1 hr to fix
          scripts/extensions/sams/src/store/assets/selectors.ts on lines 114..126

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

          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

                  this.addDictionary = function() {
                      element(by.css('[data-sd-tooltip="Add new"]')).click();
                      element(by.id('createDictionary')).click();
                      browser.sleep(100);
                  };
          Severity: Major
          Found in e2e/client/specs/helpers/dictionaries.ts and 1 other location - About 1 hr to fix
          e2e/client/specs/helpers/dictionaries.ts on lines 93..97

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

          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

              constructor(props: IProps) {
                  super(props);
          
                  this.state = {
                      selectedDestination: getInitialDestination(props.items, false),
          scripts/core/interactive-article-actions-panel/actions/fetch-to-tab.tsx on lines 27..35

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

          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 getSelectedAssetItems = createSelector<
              IApplicationState,
              Array<string>,
              Dictionary<string, IAssetItem>,
              Array<IAssetItem>
          Severity: Major
          Found in scripts/extensions/sams/src/store/assets/selectors.ts and 1 other location - About 1 hr to fix
          scripts/extensions/sams/src/store/assets/selectors.ts on lines 72..84

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

          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 (key === 'desks:preferred') {
                                  val.selected = {};
                                  scope.desks.forEach((desk) => {
                                      val.selected[desk._id] = !!desk.selected;
                                  });
          Severity: Major
          Found in scripts/apps/users/directives/UserPreferencesDirective.ts and 1 other location - About 1 hr to fix
          scripts/apps/users/directives/UserPreferencesDirective.ts on lines 407..412

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

          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 (this.props.closeOnHoverEnd && this.wrapperEl != null) {
                      this.props.referenceElement.addEventListener('mouseleave', this.closeOnMouseLeave);
                      this.wrapperEl.addEventListener('mouseleave', this.closeOnMouseLeave);
                  }
          Severity: Major
          Found in scripts/core/ui/components/popupNew.tsx and 1 other location - About 1 hr to fix
          scripts/core/ui/components/popupNew.tsx on lines 96..99

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

          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

              constructor(props: IProps) {
                  super(props);
          
                  this.state = {
                      selectedDestination: getInitialDestination(props.items, false),
          scripts/core/interactive-article-actions-panel/actions/unspike-tab.tsx on lines 23..31

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

          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 (multiActions.canRemoveIngestItems()) {
                      actions.push({
                          label: gettext('Remove'),
                          icon: 'icon-trash',
                          onTrigger: () => {
          Severity: Major
          Found in scripts/apps/search/controllers/get-bulk-actions.tsx and 1 other location - About 1 hr to fix
          scripts/apps/search/controllers/get-bulk-actions.tsx on lines 211..221

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

          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 {
              items: Array<IArticle>;
              closeFetchToView(): void;
              markupV2: boolean;
              handleUnsavedChanges(items: Array<IArticle>): Promise<Array<IArticle>>;
          scripts/core/interactive-article-actions-panel/actions/send-to-tab.tsx on lines 21..26

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

          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