superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

                        <LineInput readOnly={readOnly} hint={gettext('e.g. Rhodes, CBD')}>
                            <Label text={gettext('locality')} />
                            <Input
                                field="locality"
                                value={get(contact, 'locality', '')}
Severity: Major
Found in scripts/apps/contacts/components/Form/ProfileDetail.tsx and 1 other location - About 2 hrs to fix
scripts/apps/contacts/components/Form/ProfileDetail.tsx on lines 448..457

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

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.listeners.push(addWebsocketEventListener(
            'resource:deleted',
            (event: IWebsocketMessage<IResourceDeletedEvent>) => {
                const specs = this.listenTo[event.extra.resource];

Severity: Major
Found in scripts/core/helpers/data-provider.ts and 1 other location - About 2 hrs to fix
scripts/core/helpers/data-provider.ts on lines 111..120

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

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.listeners.push(addWebsocketEventListener(
            'resource:created',
            (event: IWebsocketMessage<IResourceCreatedEvent>) => {
                const specs = this.listenTo[event.extra.resource];

Severity: Major
Found in scripts/core/helpers/data-provider.ts and 1 other location - About 2 hrs to fix
scripts/core/helpers/data-provider.ts on lines 139..148

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

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

import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import Textarea from 'react-textarea-autosize';
import {gettext} from 'core/utils';
Severity: Minor
Found in scripts/core/editor3/components/media/MediaBlock.tsx - About 2 hrs to fix

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

        render() {
            const formConfig: IFormGroup = {
                direction: 'vertical',
                type: 'inline',
                form: [
    Severity: Major
    Found in scripts/extensions/predefinedTextField/src/config.tsx - About 2 hrs to fix

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

              link: function(scope) {
                  scope.newFetch = {};
                  scope.newPublish = {};
                  scope.deskLookup = {};
                  scope.stageLookup = {};
      Severity: Major
      Found in scripts/apps/ingest/directives/IngestRoutingAction.ts - About 2 hrs to fix

        Function MultieditService has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function MultieditService(storage, superdesk, authoringWorkspace: AuthoringWorkspaceService, referrer, $location) {
            // 1. Service manages multiedit screen
            // 2. Screen has it's boards, at least 2 of them
            // 3. Every board can be popuplated with one content item
        
        
        Severity: Major
        Found in scripts/apps/authoring/multiedit/multiedit.ts - About 2 hrs to fix

          Function VirtualListComponent has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          function VirtualListComponent<T>(props: IProps<T>, ref: React.Ref<IExposedFromVirtualList>) {
              const {totalItemsCount, loadItems, itemTemplate, width, height, initialItems} = props;
              const parentRef = React.useRef();
          
              const rowVirtualizer = useVirtual({
          Severity: Minor
          Found in scripts/core/ui/components/virtual-lists/virtual-list.tsx - About 2 hrs 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

          File index.ts has 288 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* eslint-disable complexity */
          import {
              EditorState,
              convertFromRaw,
              ContentState,
          Severity: Minor
          Found in scripts/core/editor3/store/index.ts - About 2 hrs to fix

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

                                if (versionType === 'versions') {
                                    return $q.when(_.sortBy(_.reject(result._items, {version: 0}), '_current_version').reverse());
                                } else if (versionType === 'operations') {
                                    return $q.when(_.sortBy(result._items, '_current_version'));
                                }
            Severity: Major
            Found in scripts/apps/archive/services/ArchiveService.ts and 1 other location - About 2 hrs to fix
            scripts/apps/archive/services/ArchiveService.ts on lines 179..183

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

            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

                            if (versionType === 'versions') {
                                return $q.when(_.sortBy(_.reject(result._items, {version: 0}), '_current_version').reverse());
                            } else if (versionType === 'operations') {
                                return $q.when(_.sortBy(result._items, '_current_version'));
                            }
            Severity: Major
            Found in scripts/apps/archive/services/ArchiveService.ts and 1 other location - About 2 hrs to fix
            scripts/apps/archive/services/ArchiveService.ts on lines 142..146

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

            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

            LinkInput.propTypes = {
                remove: PropTypes.func,
                field: PropTypes.string,
                value: PropTypes.string,
                label: PropTypes.string,
            Severity: Major
            Found in scripts/core/ui/components/Form/LinkInput.tsx and 2 other locations - About 2 hrs to fix
            scripts/apps/contacts/components/Form/SelectFieldSearchInput/index.tsx on lines 120..130
            scripts/core/ui/components/IconButton.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 93.

            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 (user_id !== event.detail.extra.user_id) {
                    const item_id = getSelectedSetId(store?.getState());
            
                    if (item_id === event.detail.extra.item_id) {
                        store?.dispatch(closeSetContentPanel());
            Severity: Major
            Found in scripts/extensions/sams/src/notifications/sets.ts and 1 other location - About 2 hrs to fix
            scripts/extensions/sams/src/notifications/sets.ts on lines 45..52

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

            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.login = function(username, password) {
                        return authAdapter.authenticate(username, password)
                            .then((sessionData) => api.users.getById(sessionData.user)
                                .then((userData) => {
                                    session.start(sessionData, userData);
            Severity: Major
            Found in scripts/core/auth/auth-service.ts and 1 other location - About 2 hrs to fix
            scripts/core/auth/auth-service.ts on lines 65..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 93.

            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

            IconButton.propTypes = {
                onClick: PropTypes.func,
                tabIndex: PropTypes.number,
                onKeyDown: PropTypes.func,
                onFocus: PropTypes.func,
            Severity: Major
            Found in scripts/core/ui/components/IconButton.tsx and 2 other locations - About 2 hrs to fix
            scripts/apps/contacts/components/Form/SelectFieldSearchInput/index.tsx on lines 120..130
            scripts/core/ui/components/Form/LinkInput.tsx on lines 167..177

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

            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

            SelectFieldSearchInput.propTypes = {
                field: PropTypes.string,
                label: PropTypes.string,
                value: PropTypes.string,
                onChange: PropTypes.func,
            scripts/core/ui/components/Form/LinkInput.tsx on lines 167..177
            scripts/core/ui/components/IconButton.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 93.

            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.loginXMPP = function(jid, transactionId) {
                        return authAdapter.authenticateXMPP(jid, transactionId)
                            .then((sessionData) => api.users.getById(sessionData.user)
                                .then((userData) => {
                                    session.start(sessionData, userData);
            Severity: Major
            Found in scripts/core/auth/auth-service.ts and 1 other location - About 2 hrs to fix
            scripts/core/auth/auth-service.ts on lines 19..27

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

            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 (user_id !== event.detail.extra.user_id) {
                    const item_id = getSelectedSetId(store?.getState());
            
                    if (item_id === event.detail.extra.item_id) {
                        store?.dispatch(closeSetContentPanel());
            Severity: Major
            Found in scripts/extensions/sams/src/notifications/sets.ts and 1 other location - About 2 hrs to fix
            scripts/extensions/sams/src/notifications/sets.ts on lines 23..30

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

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

            function getRundownItemAuthoringStorage(id: IRundownItem['_id']): IAuthoringStorage<IRundownItem> {
                class AutoSaveRundownItem implements IAuthoringAutoSave<IRundownItem> {
                    get() {
                        return httpRequestJsonLocal<IRundownItem>({
                            method: 'GET',

              Function exports has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function(grunt) {
                  var config = {
                      pkg: grunt.file.readJSON(path.join(__dirname, 'package.json')),
                      appDir: 'app',
                      tmpDir: '.tmp',
              Severity: Major
              Found in Gruntfile.js - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language