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

                <div>
                    <Checkbox
                        label={{text: gettext('Clean pasted HTML')}}
                        checked={config?.cleanPastedHtml ?? false}
                        onChange={(val) => {
Severity: Major
Found in scripts/apps/authoring-react/fields/editor3/config.tsx and 1 other location - About 2 hrs to fix
scripts/apps/authoring-react/fields/editor3/config.tsx on lines 55..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 89.

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

                        <Button
                            text={`${gettext('Unresolved')} (${unresolvedComments.length})`}
                            onClick={() => {
                                this.setState({selectedTab: 'unresolved'});
                            }}
scripts/apps/authoring-react/generic-widgets/inline-comments.tsx on lines 173..179

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

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.getRow = (name) => this.list.filter((elem, index) =>
            elem.element(by.binding('filterCondition.name'))
                .getText()
                .then((text) => text.toUpperCase() === name.toUpperCase()),
        );
Severity: Major
Found in e2e/client/specs/helpers/filter_conditions.ts and 1 other location - About 2 hrs to fix
e2e/client/specs/helpers/content_filters.ts on lines 58..62

Duplicated Code

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

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

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

Tuning

This issue has a mass of 89.

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.eventListenersToRemoveBeforeUnmounting.push(
            addEditorEventListener('find_and_replace__find_next', (event) => {
                const {editorId} = event.detail;

                if (editorId !== this.props.editorId) {
Severity: Major
Found in scripts/apps/authoring-react/fields/editor3/editor.tsx and 1 other location - About 2 hrs to fix
scripts/apps/authoring-react/fields/editor3/editor.tsx on lines 215..225

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

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

                        <Button
                            text={`${gettext('Resolved')} (${resolvedComments.length})`}
                            onClick={() => {
                                this.setState({selectedTab: 'resolved'});
                            }}
scripts/apps/authoring-react/generic-widgets/inline-comments.tsx on lines 165..171

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

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 get-content-profiles-form-config.tsx has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {FormFieldType} from 'core/ui/components/generic-form/interfaces/form';
import {
    IFormField,
    IFormGroup,
    IContentProfileEditorConfig,

    Function onSubmit has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        onSubmit() {
            this.setState({submitting: true});
            let requestsCompleted = 0;
            let failed = false;
    
    
    Severity: Major
    Found in scripts/extensions/sams/src/containers/FileUploadModal.tsx - About 2 hrs to fix

      Function fetchItems has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function fetchItems(
          items: Array<IArticle>,
          selectedDestination: ISendToDestinationDesk,
      ): Promise<Array<IArticle>> {
          return new Promise((resolve, reject) => {
      Severity: Major
      Found in scripts/api/article-fetch.tsx - About 2 hrs to fix

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

                    render() {
                        return (
                            <Modal
                                visible
                                zIndex={1050}
        Severity: Major
        Found in scripts/apps/authoring/authoring/services/quick-publish-modal.tsx - About 2 hrs to fix

          Function getUnpublishConfirmModal has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function getUnpublishConfirmModal(
              item: IArticle,
              related: Array<IArticle>,
              unpublish: (related: IState['related']) => any,
          ): React.ComponentType<IProps> {

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

                    link: function(scope, element) {
                        scope.locators = [];
            
                        scope.$applyAsync(() => {
                            if (scope.item) {
            Severity: Major
            Found in scripts/apps/authoring/metadata/metadata.ts - About 2 hrs to fix

              Function SearchPanel has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function SearchPanel($location,
                  desks,
                  privileges,
                  asset,
                  metadata,
              Severity: Major
              Found in scripts/apps/search/directives/SearchPanel.ts - About 2 hrs to fix

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

                    render() {
                        const {markupV2} = this.props;
                
                        const canFetch: boolean = (() => {
                            if (this.state.selectedDestination.type === 'personal-space') {

                  AuthoringReact has 24 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export class AuthoringReact<T extends IBaseRestApiResponse> extends React.PureComponent<IPropsAuthoring<T>, IState<T>> {
                      private cleanupFunctionsToRunBeforeUnmounting: Array<() => void>;
                      private _mounted: boolean;
                      private componentRef: HTMLElement | null;
                  
                  
                  Severity: Minor
                  Found in scripts/apps/authoring-react/authoring-react.tsx - About 2 hrs to fix

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

                    export class GridItemContent extends React.PureComponent<IProps> {
                        render() {
                            const classes = classNames(
                                'sd-grid-item__content',
                                {'sd-grid-item__content--scrollable': this.props.scrollable},
                    Severity: Major
                    Found in scripts/extensions/sams/src/ui/grid/GridItemContent.tsx and 3 other locations - About 2 hrs to fix
                    scripts/extensions/sams/src/ui/FormGroup.tsx on lines 9..24
                    scripts/extensions/sams/src/ui/PanelHeaderSlidingToolbar.tsx on lines 8..23
                    scripts/extensions/sams/src/ui/list/ListItemActionMenu.tsx on lines 9..22

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

                    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 (multiSelectable) {
                                        if (_.findIndex(scope.selectedList, {_id: item._id}) === -1) {
                                            scope.selectedList.push(item);
                                        } else {
                                            _.remove(scope.selectedList, {_id: item._id});
                    Severity: Major
                    Found in scripts/apps/archive/directives/ContentResults.ts and 1 other location - About 2 hrs to fix
                    scripts/apps/search/directives/SearchResults.ts on lines 455..461

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

                    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

                    export class PanelHeaderSlidingToolbar extends React.PureComponent<IProps> {
                        render() {
                            const classes = classNames(
                                'subnav__sliding-toolbar',
                                {
                    scripts/extensions/sams/src/ui/FormGroup.tsx on lines 9..24
                    scripts/extensions/sams/src/ui/grid/GridItemContent.tsx on lines 9..22
                    scripts/extensions/sams/src/ui/list/ListItemActionMenu.tsx on lines 9..22

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

                    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

                    export class ListItemActionMenu extends React.PureComponent<IProps> {
                        render() {
                            const classes = classNames(
                                'sd-list-item__action-menu',
                                {'sd-list-item__action-menu--direction-row': this.props.row},
                    Severity: Major
                    Found in scripts/extensions/sams/src/ui/list/ListItemActionMenu.tsx and 3 other locations - About 2 hrs to fix
                    scripts/extensions/sams/src/ui/FormGroup.tsx on lines 9..24
                    scripts/extensions/sams/src/ui/PanelHeaderSlidingToolbar.tsx on lines 8..23
                    scripts/extensions/sams/src/ui/grid/GridItemContent.tsx on lines 9..22

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

                    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

                    export class FormGroup extends React.PureComponent<IProps> {
                        render() {
                            const classes = classNames(
                                'form__group',
                                {
                    Severity: Major
                    Found in scripts/extensions/sams/src/ui/FormGroup.tsx and 3 other locations - About 2 hrs to fix
                    scripts/extensions/sams/src/ui/PanelHeaderSlidingToolbar.tsx on lines 8..23
                    scripts/extensions/sams/src/ui/grid/GridItemContent.tsx on lines 9..22
                    scripts/extensions/sams/src/ui/list/ListItemActionMenu.tsx on lines 9..22

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

                    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 (multiSelectable) {
                                        if (_.findIndex(scope.selectedList, {_id: item._id}) === -1) {
                                            scope.selectedList.push(item);
                                        } else {
                                            _.remove(scope.selectedList, {_id: item._id});
                    Severity: Major
                    Found in scripts/apps/search/directives/SearchResults.ts and 1 other location - About 2 hrs to fix
                    scripts/apps/archive/directives/ContentResults.ts on lines 39..45

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

                    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