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

        it('can delete', inject((api, $httpBackend) => {
            var user = {_links: {self: {href: USER_PATH}}},
                then = jasmine.createSpy('then');

            $httpBackend.expectDELETE(USER_URL).respond(204);
Severity: Major
Found in scripts/core/api/api-service.spec.ts and 1 other location - About 4 hrs to fix
scripts/core/api/api-service.spec.ts on lines 221..232

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

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 addInternalWebsocketEventListener<T extends keyof IInternalWebsocketMessages>(
    event: T,
    handler: (message: IInternalWebsocketMessages[T]) => void,
): () => void {
    const eventName = getInternalWebsocketMessageEventName(event);
Severity: Major
Found in scripts/core/notification/notification.ts and 1 other location - About 4 hrs to fix
scripts/core/notification/notification.ts on lines 65..75

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

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.removeFromFirstHighlight = function(group, item) {
            var crtItem = this.getItem(group, item);

            crtItem.element(by.className('icon-multi-star')).click();
            var highlightList = element(by.className('highlights-list-menu'));
Severity: Major
Found in e2e/client/specs/helpers/monitoring.ts and 1 other location - About 4 hrs to fix
e2e/client/specs/helpers/monitoring.ts on lines 851..859

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

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

        it('handles delete on deleted resource as success', inject((api, $httpBackend) => {
            var user = {_links: {self: {href: USER_PATH}}},
                then = jasmine.createSpy('then');

            $httpBackend.expectDELETE(USER_URL).respond(404);
Severity: Major
Found in scripts/core/api/api-service.spec.ts and 1 other location - About 4 hrs to fix
scripts/core/api/api-service.spec.ts on lines 208..219

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

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 addWebsocketEventListener<T extends keyof IPublicWebsocketMessages>(
    event: T,
    handler: (message: IPublicWebsocketMessages[T]) => void,
): () => void {
    const eventName = getWebsocketMessageEventName(event);
Severity: Major
Found in scripts/core/notification/notification.ts and 1 other location - About 4 hrs to fix
scripts/core/notification/notification.ts on lines 77..87

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    render() {
        const {items, markupV2} = this.props;
        const itemToOpenAfterSending: IArticle['_id'] | null = (() => {
            if (items.length !== 1) {
                return null;

    File assetFilterPanel.tsx has 348 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // External Modules
    import * as React from 'react';
    import {noop} from 'lodash';
    
    // Types
    Severity: Minor
    Found in scripts/extensions/sams/src/components/assets/assetFilterPanel.tsx - About 4 hrs to fix

      File spellcheck.ts has 348 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {getSpellchecker} from 'core/editor3/components/spellchecker/default-spellcheckers';
      import {gettext} from 'core/utils';
      import {debounce, once} from 'lodash';
      import {getStores, unsetStore} from '../editor3/store';
      import {setAbbreviations} from 'core/editor3/actions';
      Severity: Minor
      Found in scripts/core/spellcheck/spellcheck.ts - About 4 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                if (activeCell == null) {
                    return (
                        <div
                            className={cx}
                            style={{
        Severity: Critical
        Found in scripts/core/editor3/components/toolbar/index.tsx - About 4 hrs to fix

          File get-multi-actions.tsx has 347 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import _, {flatMap} from 'lodash';
          import {IArticle} from 'superdesk-api';
          import {gettext} from 'core/utils';
          
          import {IExtensionActivationResult} from 'superdesk-api';
          Severity: Minor
          Found in scripts/apps/search/controllers/get-multi-actions.tsx - About 4 hrs to fix

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

                render() {
                    const {filters} = this.props;
            
                    return (
                        <React.Fragment>

              Function connectCrudManagerHttp has 108 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function connectCrudManagerHttp<Props, Entity extends IBaseRestApiResponse>(
                  // type stoped working after react 16.8 upgrade. See if it's fixed by a future React types or TypeScript update
                  WrappedComponent, // : React.ComponentType<Props & PropsToConnect>
                  name: string,
                  endpoint: string,
              Severity: Major
              Found in scripts/core/helpers/crud-manager-http.tsx - About 4 hrs to fix

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

                                {
                                    filters.airtime_time?.lte != null && (
                                        <Tag
                                            text={filters.airtime_time.lte}
                                            label={gettext('Airtime time to')}
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 46..62
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 82..98
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 100..116

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

                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 unsubscribeUser = (
                    savedSearch: ISavedSearch,
                    userId: IUser['_id'],
                    api: any,
                ): Promise<ISavedSearch> => {
                Severity: Major
                Found in scripts/apps/search/SavedSearch.ts and 1 other location - About 4 hrs to fix
                scripts/apps/search/SavedSearch.ts on lines 107..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 121.

                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

                                {
                                    filters.airtime_date?.lte != null && (
                                        <Tag
                                            text={filters.airtime_date.lte}
                                            label={gettext('Airtime date to')}
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 46..62
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 64..80
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 82..98

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

                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 unsubscribeDesk = (
                    savedSearch: ISavedSearch,
                    deskId: IDesk['_id'],
                    api: any,
                ): Promise<ISavedSearch> => {
                Severity: Major
                Found in scripts/apps/search/SavedSearch.ts and 1 other location - About 4 hrs to fix
                scripts/apps/search/SavedSearch.ts on lines 92..105

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 121.

                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

                                {
                                    filters.airtime_time?.gte != null && (
                                        <Tag
                                            text={filters.airtime_time.gte}
                                            label={gettext('Airtime time from')}
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 64..80
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 82..98
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 100..116

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

                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

                                {
                                    filters.airtime_date?.gte != null && (
                                        <Tag
                                            text={filters.airtime_date.gte}
                                            label={gettext('Airtime date from')}
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 46..62
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 64..80
                scripts/extensions/broadcasting/src/rundowns/components/applied-filters.tsx on lines 100..116

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

                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

                    onCheckboxClick(e: React.MouseEvent<HTMLDivElement>) {
                        this.stopClickPropagation(e);
                        if (e.shiftKey && this.props.updateMultipleSelectedAssetIds) {
                            this.props.updateMultipleSelectedAssetIds(this.props.asset);
                        } else if (this.props.updateSelectedAssetIds) {
                scripts/extensions/sams/src/components/assets/assetListItem.tsx on lines 71..78

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

                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

                    onCheckboxClick(e: React.MouseEvent<HTMLDivElement>) {
                        this.stopClickPropagation(e);
                        if (e.shiftKey && this.props.updateMultipleSelectedAssetIds) {
                            this.props.updateMultipleSelectedAssetIds(this.props.asset);
                        } else if (this.props.updateSelectedAssetIds) {
                scripts/extensions/sams/src/components/assets/assetGridItem.tsx on lines 88..95

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

                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