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

export function getActiveSets(state: IApplicationState): Array<ISetItem> {
    return state.sets.sets.filter(
        (set) => set.state === SET_STATE.USABLE,
    );
}
Severity: Major
Found in scripts/extensions/sams/src/store/sets/selectors.ts and 1 other location - About 1 hr to fix
scripts/extensions/sams/src/store/sets/selectors.ts on lines 37..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 65.

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

    onSearchChange(event) {
        const value = event.target.value;

        this.setState(
            {searchInputValue: value || ''},
Severity: Major
Found in scripts/core/ui/components/SearchField/index.tsx and 1 other location - About 1 hr to fix
scripts/core/ui/components/SearchBar/index.tsx on lines 72..80

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

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 (scope.step.current === 'general' && Object.keys(diff).length > 0) {
                    scope.saveEnabled = true;
                } else {
                    scope.saveEnabled = false;
                }
Severity: Major
Found in scripts/apps/desks/directives/DeskeditBasic.ts and 1 other location - About 1 hr to fix
scripts/apps/desks/directives/DeskeditPeople.ts on lines 78..82

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

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 (scope.step.current === 'people' && Object.keys(diff).length > 0) {
                    scope.saveEnabled = true;
                } else {
                    scope.saveEnabled = false;
                }
Severity: Major
Found in scripts/apps/desks/directives/DeskeditPeople.ts and 1 other location - About 1 hr to fix
scripts/apps/desks/directives/DeskeditBasic.ts on lines 99..103

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

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

    {
        _id: 1,
        slugline: 'slugline',
        word_count: 10,
        firstcreated: 'ddmmyy',
Severity: Major
Found in scripts/apps/authoring/suggest/suggest.spec.ts and 1 other location - About 1 hr to fix
scripts/apps/authoring/suggest/suggest.spec.ts on lines 15..28

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

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

                                            <DropdownOption
                                                label={gettext('Create package')}
                                                icon={{name: 'package-plus'}}
                                                onClick={() => {
                                                    this.create({kind: 'create-package'});
scripts/core/ui/components/content-create-dropdown/initial-view.tsx on lines 209..216

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

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

            component: () => (
                <Button
                    text={gettext('Save')}
                    style="filled"
                    type="primary"
Severity: Major
Found in scripts/apps/authoring-react/multi-edit-modal.tsx and 1 other location - About 1 hr to fix
scripts/apps/authoring-react/authoring-angular-integration.tsx on lines 62..72

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

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

        component: () => (
            <Button
                text={gettext('Save')}
                style="filled"
                type="primary"
scripts/apps/authoring-react/multi-edit-modal.tsx on lines 53..63

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

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

                                    <DropdownOption
                                        label={gettext('Upload media')}
                                        icon={{name: 'upload'}}
                                        onClick={() => {
                                            this.create({kind: 'upload-media'});
scripts/core/ui/components/content-create-dropdown/initial-view.tsx on lines 198..205

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

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

    onSearchChange(event) {
        const value = event.target.value;

        this.setState(
            {searchInputValue: value || ''},
Severity: Major
Found in scripts/core/ui/components/SearchBar/index.tsx and 1 other location - About 1 hr to fix
scripts/core/ui/components/SearchField/index.tsx on lines 35..43

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

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 getDisabledSets(state: IApplicationState): Array<ISetItem> {
    return state.sets.sets.filter(
        (set) => set.state === SET_STATE.DISABLED,
    );
}
Severity: Major
Found in scripts/extensions/sams/src/store/sets/selectors.ts and 1 other location - About 1 hr to fix
scripts/extensions/sams/src/store/sets/selectors.ts on lines 31..35

Duplicated Code

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

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

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

Tuning

This issue has a mass of 65.

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

    }, {
        _id: 2,
        slugline: 'slugline2',
        word_count: 11,
        firstcreated: 'ddmmyy2',
Severity: Major
Found in scripts/apps/authoring/suggest/suggest.spec.ts and 1 other location - About 1 hr to fix
scripts/apps/authoring/suggest/suggest.spec.ts on lines 2..15

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

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

      this.undo = function undo(exp, scope) {
        scope = scope || $rootScope;
        if (isUndefined(exp)) {
          throw new Error('expression required');
        }
Severity: Minor
Found in scripts/libs/angular-history/history.js - About 1 hr to fix

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

        render() {
            return (
                <React.Fragment>
                    <ListHeader title={this.props.title} marginTop={this.props.marginTop} />
                    <ListItemGroup spaceBetweenItems={true}>
    Severity: Minor
    Found in scripts/extensions/sams/src/components/sets/setListGroup.tsx - About 1 hr to fix

      Function getPublishToolbarWidget has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getPublishToolbarWidget(
          panelState: IStateInteractiveActionsPanelHOC,
          panelActions: IActionsInteractiveActionsPanelHOC,
      ): ITopBarWidget<IArticle> {
          const publishWidgetButton: ITopBarWidget<IArticle> = {
      Severity: Minor
      Found in scripts/apps/authoring-react/authoring-angular-integration.tsx - About 1 hr to fix

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

            render() {
                const metadataFields: Array<{label: string; field: keyof IArticle}> = [
                    {
                        label: gettext('Alt text:'),
                        field: 'alt_text',
        Severity: Minor
        Found in scripts/apps/authoring-react/fields/media/media-metadata.tsx - About 1 hr to fix

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

                  render() {
                      const {miniToolbar, sectionClassNames} = this.props;
          
                      return (
                          <div className={sectionClassNames?.content}>

            Function storeValue has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            storeValue: (val: string | Array<string>, article) => {
                                interface IStorageFormat {
                                    qcode: string;
                                    name: string;
                                    parent?: string;
            Severity: Minor
            Found in scripts/apps/authoring-react/field-adapters/index.tsx - About 1 hr to fix

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

                      link: function(scope) {
                          let _isDirty;
              
                          /**
                           * Set dirty on autosave - it is called on change
              Severity: Minor
              Found in scripts/apps/templates/directives/TemplateEditorModal.ts - About 1 hr to fix

                Function initCriteria has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function initCriteria(search, filter) {
                        const query: any = {};
                        const canSeeSupportUsers = usersService.isSupport(session.identity);
                
                        if (!canSeeSupportUsers) {
                Severity: Minor
                Found in scripts/apps/users/controllers/UserListController.ts - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language