superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

        constructor(props: IProps) {
            super(props);

            this.state = {
                files: [],
Severity: Major
Found in scripts/apps/vocabularies/components/UploadConfigModal.tsx and 2 other locations - About 2 hrs to fix
scripts/apps/highlights/components/SetHighlightsForMultipleArticlesModal.tsx on lines 21..30
scripts/extensions/sams/src/components/common/DesksSelectInput.tsx on lines 34..41

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

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

angular.module('superdesk.apps.authoring.compare_versions',
    ['superdesk.core.activity', 'superdesk.apps.authoring'])
    .service('compareVersions', CompareVersionsService)
    .directive('sdCompareVersionsInnerDropdown', directive.CompareVersionsDropdownInnerDirective)
    .directive('sdCompareVersionsArticle', directive.CompareVersionsArticleDirective)
Severity: Major
Found in scripts/apps/authoring/compare-versions/index.ts and 1 other location - About 2 hrs to fix
scripts/apps/authoring/multiedit/multiedit.ts on lines 331..351

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

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

angular.module('superdesk.apps.authoring.multiedit', ['superdesk.core.activity', 'superdesk.apps.authoring'])
    .service('multiEdit', MultieditService)
    .directive('sdMultieditDropdown', MultieditDropdownDirective)
    .directive('sdMultieditInnerDropdown', MultieditDropdownInnerDirective)
    .directive('sdMultieditArticle', MultieditArticleDirective)
Severity: Major
Found in scripts/apps/authoring/multiedit/multiedit.ts and 1 other location - About 2 hrs to fix
scripts/apps/authoring/compare-versions/index.ts on lines 15..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 86.

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

import _ from 'lodash';
import {gettext} from 'core/utils';

import {
    DESK_OUTPUT,
Severity: Minor
Found in scripts/apps/monitoring/directives/AggregateSettings.ts - About 2 hrs to fix

    File CrudManager.tsx has 272 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {appConfig} from 'appConfig';
    import ng from 'core/services/ng';
    import {generate} from 'json-merge-patch';
    import {isObject, keyBy, partition} from 'lodash';
    import {
    Severity: Minor
    Found in scripts/core/helpers/CrudManager.tsx - About 2 hrs to fix

      Function _clear has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            this._clear = function _clear(scope, exps) {
              var id = scope.$id,
                i,
                nextSibling,
                exp,
      Severity: Major
      Found in scripts/libs/angular-history/history.js - About 2 hrs to fix

        Function getExistingTags has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function getExistingTags(article: IArticle): IServerResponse {
            const result: IServerResponse = {};
        
            getServerResponseKeys().forEach((key) => {
                const values = (article[key] ?? []).filter((tag) => tag.source === SOURCE_IMATRICS);
        Severity: Major
        Found in scripts/extensions/auto-tagging-widget/src/data-transformations.ts - About 2 hrs to fix

          Function SortPackageItems has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Function UserPrivilegesDirective has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function UserPrivilegesDirective(api, notify, userList, $q) {
                return {
                    scope: {
                        user: '=',
                    },
            Severity: Major
            Found in scripts/apps/users/directives/UserPrivilegesDirective.ts - About 2 hrs to fix

              Function save has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          scope.save = function() {
                              new Promise((resolve) => {
                                  if (
                                      scope.user._id !== session.identity._id // changing language for another user
                                      || scope.user.language === scope.origUser.language
              Severity: Major
              Found in scripts/apps/users/directives/UserEditDirective.ts - About 2 hrs to fix

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

                    render() {
                        if (this.state.initialized !== true) {
                            return null;
                        }
                
                
                Severity: Major
                Found in scripts/core/ArticlesListV2.tsx - About 2 hrs to fix

                  File ItemListAngularWrapper.tsx has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React from 'react';
                  import {forOwn, startsWith, indexOf} from 'lodash';
                  import ng from 'core/services/ng';
                  import {ItemList} from 'apps/search/components';
                  import {
                  Severity: Minor
                  Found in scripts/apps/search/components/ItemListAngularWrapper.tsx - About 2 hrs to fix

                    AuthoringWorkspaceService has 23 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export class AuthoringWorkspaceService {
                        private $location: any;
                        private superdeskFlags: any;
                        private authoring: any;
                        private send: any;

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

                                  if (!skipConfirm) {
                                      var modal = element(by.className('modal__dialog'));
                      
                                      modal.isPresent().then((isPresent) => {
                                          if (isPresent) {
                      Severity: Major
                      Found in e2e/client/specs/helpers/authoring.ts and 1 other location - About 2 hrs to fix
                      e2e/client/specs/helpers/authoring.ts on lines 434..442

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

                      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

                                      <div>
                                          <Checkbox
                                              label={{text: gettext('Allow video')}}
                                              checked={config.allowVideo}
                                              onChange={(val) => {
                      Severity: Major
                      Found in scripts/apps/authoring-react/fields/media/config.tsx and 2 other locations - About 2 hrs to fix
                      scripts/apps/authoring-react/fields/media/config.tsx on lines 36..44
                      scripts/apps/authoring-react/fields/media/config.tsx on lines 66..74

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

                      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

                                      <div>
                                          <Checkbox
                                              label={{text: gettext('Allow picture')}}
                                              checked={config.allowPicture}
                                              onChange={(val) => {
                      Severity: Major
                      Found in scripts/apps/authoring-react/fields/media/config.tsx and 2 other locations - About 2 hrs to fix
                      scripts/apps/authoring-react/fields/media/config.tsx on lines 56..64
                      scripts/apps/authoring-react/fields/media/config.tsx on lines 66..74

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

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

                                  <div
                                      className={
                                          classNames(
                                              'sd-line-input',
                                              {
                      scripts/core/ui/components/generic-form/input-types/duration.tsx on lines 19..51
                      scripts/core/ui/components/generic-form/input-types/select_multiple_values.tsx on lines 31..71
                      scripts/core/ui/components/generic-form/input-types/select_single_value_static.tsx on lines 24..58

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

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

                                  <div
                                      className={
                                          classNames(
                                              'sd-line-input',
                                              {
                      scripts/core/ui/components/generic-form/input-types/duration.tsx on lines 19..51
                      scripts/core/ui/components/generic-form/input-types/number.tsx on lines 16..42
                      scripts/core/ui/components/generic-form/input-types/select_single_value_static.tsx on lines 24..58

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

                      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

                                      <div>
                                          <Checkbox
                                              label={{text: gettext('Allow audio')}}
                                              checked={config.allowAudio}
                                              onChange={(val) => {
                      Severity: Major
                      Found in scripts/apps/authoring-react/fields/media/config.tsx and 2 other locations - About 2 hrs to fix
                      scripts/apps/authoring-react/fields/media/config.tsx on lines 36..44
                      scripts/apps/authoring-react/fields/media/config.tsx on lines 56..64

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

                      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

                          packages.createPackageFromItems([openItem, data.item])
                              .then((newPackage) => {
                                  authoringWorkspace.edit(newPackage);
                              }, (response) => {
                                  if (response.status === 403 && response.data && response.data._message) {
                      Severity: Major
                      Found in scripts/apps/packaging/controllers/CombinePackageCtrl.ts and 1 other location - About 2 hrs to fix
                      scripts/apps/packaging/controllers/PackageItemCtrl.ts 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 85.

                      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