superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function TopMenuInfoDirective has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function TopMenuInfoDirective(desks, $timeout, config) {
    return {
        template: require('./views/top-menu-info.html'),
        link: (scope) => {
            const setup = debounce(() => {
Severity: Major
Found in scripts/apps/dashboard/closed-desk/index.ts - About 2 hrs to fix

    Function _queryItems has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                function _queryItems(data: any | undefined, initiatedAt: ReturnType<DateConstructor['now']>) {
                    const pageSize: number = 50;
    
                    criteria = search.query(getSearch(), queryOptions).getCriteria(true);
                    criteria.source.size = pageSize;
    Severity: Major
    Found in scripts/apps/search/directives/SearchResults.ts - About 2 hrs to fix

      Function getTemplate has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              const getTemplate = () => {
                  switch (this.props.view) {
                  case 'swimlane2':
                      return (
                          <ItemSwimlane
      Severity: Major
      Found in scripts/apps/search/components/Item.tsx - About 2 hrs to fix

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

            constructor(desks, tags, $location, scope, elem, metadata, session) {
                this.scope = scope;
                this.elem = elem;
                this.tags = tags;
                this.$location = $location;
        Severity: Major
        Found in scripts/apps/search/directives/SearchFilters.ts - About 2 hrs to fix

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

              handleClickOutside(event) {
                  if (!this.dom.root || this.dom.root.contains(event.target) || !document.contains(event.target)) {
                      return;
                  }
          
          
          Severity: Major
          Found in scripts/apps/contacts/components/Popup/Popup.tsx and 1 other location - About 2 hrs to fix
          scripts/core/ui/components/Popup/Popup.tsx on lines 108..114

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

          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

              handleClickOutside(event) {
                  if (!this.dom.root || this.dom.root.contains(event.target) || !document.contains(event.target)) {
                      return;
                  }
          
          
          Severity: Major
          Found in scripts/core/ui/components/Popup/Popup.tsx and 1 other location - About 2 hrs to fix
          scripts/apps/contacts/components/Popup/Popup.tsx on lines 107..113

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

          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

                  const articleDisplayWidgets = flatMap(
                      Object.values(extensions).map(({activationResult}) => activationResult),
                      (activationResult) =>
                          activationResult.contributions != null
                          && activationResult.contributions.authoringTopbarWidgets != null
          Severity: Major
          Found in scripts/apps/authoring/authoring/authoring-topbar-react.tsx and 1 other location - About 2 hrs to fix
          scripts/apps/authoring/authoring/authoring-media-actions.tsx on lines 12..19

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

          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

                          highlightsById: highlightsService.get().then((result) => {
                              var highlightsById = {};
          
                              result._items.forEach((item) => {
                                  highlightsById[item._id] = item;
          Severity: Major
          Found in scripts/apps/search/services/MonitoringState.ts and 1 other location - About 2 hrs to fix
          scripts/apps/search/services/MonitoringState.ts on lines 55..62

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

          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 getMonthNames(targetLocale: string): Array<string> {
              const currentLocale = moment.locale();
          
              moment.locale(targetLocale);
          
          
          Severity: Major
          Found in scripts/core/helpers/locale.ts and 1 other location - About 2 hrs to fix
          scripts/core/helpers/locale.ts on lines 3..13

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

          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

              var styles = [
                  {txt: gettext('Short'), cls: 'red'},
                  {txt: gettext('Weak'), cls: 'red'},
                  {txt: gettext('Better'), cls: 'yellow'},
                  {txt: gettext('OK'), cls: 'green'},
          Severity: Major
          Found in scripts/core/directives/PasswordStrengthDirective.ts and 1 other location - About 2 hrs to fix
          scripts/apps/authoring-react/fields/media/media-metadata.tsx on lines 13..34

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

          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

                  const metadataFields: Array<{label: string; field: keyof IArticle}> = [
                      {
                          label: gettext('Alt text:'),
                          field: 'alt_text',
                      },
          Severity: Major
          Found in scripts/apps/authoring-react/fields/media/media-metadata.tsx and 1 other location - About 2 hrs to fix
          scripts/core/directives/PasswordStrengthDirective.ts on lines 36..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 83.

          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

                  const mediaActions = flatMap(
                      Object.values(extensions).map(({activationResult}) => activationResult),
                      (activationResult) =>
                          activationResult.contributions != null
                          && activationResult.contributions.mediaActions != null
          Severity: Major
          Found in scripts/apps/authoring/authoring/authoring-media-actions.tsx and 1 other location - About 2 hrs to fix
          scripts/apps/authoring/authoring/authoring-topbar-react.tsx on lines 66..73

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

          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 getMonthNamesShort(targetLocale: string): Array<string> {
              const currentLocale = moment.locale();
          
              moment.locale(targetLocale);
          
          
          Severity: Major
          Found in scripts/core/helpers/locale.ts and 1 other location - About 2 hrs to fix
          scripts/core/helpers/locale.ts on lines 15..25

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

          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

                          markedDesksById: desks.fetchDesks().then((result) => {
                              var markedDesksById = {};
          
                              result._items.forEach((item) => {
                                  markedDesksById[item._id] = item;
          Severity: Major
          Found in scripts/apps/search/services/MonitoringState.ts and 1 other location - About 2 hrs to fix
          scripts/apps/search/services/MonitoringState.ts on lines 47..54

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

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

          import React, {CSSProperties} from 'react';
          import {IArticle, IRestApiResponse} from 'superdesk-api';
          import {Button, ToggleBox} from 'superdesk-ui-framework/react';
          import {gettext} from 'core/utils';
          import {PanelContent} from '../panel/panel-content';

            File ArticlesListV2.tsx has 266 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable react/no-multi-comp */
            
            import React from 'react';
            import ng from 'core/services/ng';
            import {
            Severity: Minor
            Found in scripts/core/ArticlesListV2.tsx - About 2 hrs to fix

              Function UserEditDirective has 19 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              export function UserEditDirective(api, notify, usersService, userList, session, _,
                  langmap, $location, $route, superdesk, features, asset, privileges, desks, keyboardManager,
                  gettextCatalog, metadata, modal, $q) {
              Severity: Major
              Found in scripts/apps/users/directives/UserEditDirective.ts - About 2 hrs to fix

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

                    render() {
                        const {gettext} = superdeskApi.localization;
                        const selectedAssetIds = Object.keys(this.state.selectedItems);
                
                        return (
                Severity: Major
                Found in scripts/extensions/sams/src/components/assets/selectAssetModal.tsx - About 2 hrs to fix

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

                          link: function(scope, element) {
                              var updated = false;
                  
                              element.sortable({
                                  items: '.package-edit-items li',
                  Severity: Major
                  Found in scripts/apps/packaging/directives/SortPackageItems.ts - About 2 hrs to fix

                    Function ContentResults has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function ContentResults($location, preferencesService, packages: IPackagesService, tags, asset, search) {
                        var update = {
                            'archive:view': {
                                allowed: [
                                    'mgrid',
                    Severity: Major
                    Found in scripts/apps/archive/directives/ContentResults.ts - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language