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

                    leftPanel={(
                        this.props.filterPanelOpen === false ? (
                            <div />
                        ) : (
                            <AssetFilterPanel
Severity: Major
Found in scripts/extensions/sams/src/apps/samsWorkspace.tsx and 1 other location - About 2 hrs to fix
scripts/extensions/sams/src/components/assets/selectAssetModal.tsx on lines 184..194

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

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.props.original == null ? null : (
                        <PanelContentBlock flex={true}>
                            <PanelContentBlockInner grow={true}>
                                <VersionUserDateLines item={this.props.original} />
                            </PanelContentBlockInner>
scripts/extensions/sams/src/components/assets/assetEditorPanel.tsx on lines 139..145

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

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

Consider simplifying this complex logical expression.
Open

        } else if (isPublishedOrCorrected) {
            action.kill = userPrivileges.kill && lockedByMe && !isReadOnlyState;
            action.correct = userPrivileges.correct && lockedByMe && !isReadOnlyState
                && !isBeingCorrected(currentItem) && !isCorrection(currentItem);
            action.takedown = userPrivileges.takedown && lockedByMe && !isReadOnlyState;
Severity: Critical
Found in scripts/apps/authoring/authoring/services/AuthoringService.ts - About 2 hrs to fix

    Function componentDidUpdate has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        componentDidUpdate(prevProps: IProps, prevState: IState) {
            if (prevState.fields != null && prevState.fields !== this.state.fields) {
                const editorCopy = {...this.state.editor};
                const schemaCopy = {...this.state.schema};
    
    

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

          render() {
              if (this.state.defaultTheme == null) {
                  return null;
              }
      
      
      Severity: Major
      Found in scripts/apps/authoring-react/toolbar/proofreading-theme-modal.tsx - About 2 hrs to fix

        Function AuthoringEmbeddedDirective has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function AuthoringEmbeddedDirective(api, notify, $filter) {
            return {
                template: authoringReactViewEnabled
                    ? (
                        '<div>' +

          Function getInitialDestination has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function getInitialDestination(
              items: Array<IArticle>,
              canSendToPersonal: boolean,
              availableDesks: OrderedMap<string, IDesk> = sdApi.desks.getAllDesks(),
          ): ISendToDestination {

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

                render() {
                    const {scope, monitoringState} = this.props;
            
                    const style = scope.styleProperties == null
                        ? null
            Severity: Major
            Found in scripts/apps/search/components/ItemListAngularWrapper.tsx - About 2 hrs to fix

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

                  render() {
                      const {
                          target,
                          onCancel,
                          title,

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

                    render() {
                        return this.state.loading === false && (
                            <ToggleBox title={gettext('Target')} initiallyOpen>
                                <FormLabel text={gettext('Target subscribers')} />
                
                

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

                      render() {
                          const {value, label, labelKey, searchKey, valueKey, popupContainer, readOnly, onFocus, ...props} = this.props;
                          const options = this.removeValuesFromOptions();
                  
                          return (
                  Severity: Major
                  Found in scripts/core/ui/components/Form/SelectMetaTermsInput/index.tsx - About 2 hrs to fix

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

                        render() {
                            const {props} = this;
                            const {getId, getLabel} = props;
                            const optionTemplateDefault: React.ComponentType<{item: T}> = ({item}) => (<span>{getLabel(item)}</span>);
                            const OptionTemplate = this.props.optionTemplate ?? optionTemplateDefault;
                    Severity: Major
                    Found in scripts/core/ui/components/MultiSelectTreeWithTemplate.tsx - About 2 hrs to fix

                      Function replaceWord has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const replaceWord = (state, replaceWordData: IReplaceWordData, skipOnChange = false) => {
                          const {editorState, suggestingMode} = state;
                      
                          const {word, newWord} = replaceWordData;
                      
                      
                      Severity: Major
                      Found in scripts/core/editor3/reducers/spellchecker.tsx - About 2 hrs to fix

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

                                browser.wait(() => element(by.id('ingest-settings')).isDisplayed(), 1000).then(() => {
                                    expect(element(by.id('ingest-settings')).isDisplayed()).toBe(true);
                                });
                        Severity: Major
                        Found in e2e/client/specs/ingest_provider_spec.ts and 1 other location - About 2 hrs to fix
                        e2e/client/specs/ingest_provider_spec.ts on lines 78..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 81.

                        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

                                const globalMenuHorizontalItems = flatMap(
                                    Object.values(extensions).map(({activationResult}) => activationResult),
                                    (activationResult) =>
                                        activationResult.contributions != null
                                        && activationResult.contributions.globalMenuHorizontal != null
                        Severity: Major
                        Found in scripts/core/menu/GlobalMenuHorizontal.tsx and 2 other locations - About 2 hrs to fix
                        scripts/apps/search/components/ListItemInfo.tsx on lines 35..42
                        scripts/apps/search/components/PhotoDeskInfo.tsx on lines 21..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 81.

                        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

                            const articleDisplayWidgets = flatMap(
                                Object.values(extensions).map(({activationResult}) => activationResult),
                                (activationResult) =>
                                    activationResult.contributions != null
                                    && activationResult.contributions.articleGridItemWidgets != null
                        Severity: Major
                        Found in scripts/apps/search/components/PhotoDeskInfo.tsx and 2 other locations - About 2 hrs to fix
                        scripts/apps/search/components/ListItemInfo.tsx on lines 35..42
                        scripts/core/menu/GlobalMenuHorizontal.tsx on lines 7..14

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

                        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

                                browser.wait(() => element(by.id('ingest-settings')).isDisplayed(), 1000).then(() => {
                                    expect(element(by.id('ingest-settings')).isDisplayed()).toBe(true);
                                });
                        Severity: Major
                        Found in e2e/client/specs/ingest_provider_spec.ts and 1 other location - About 2 hrs to fix
                        e2e/client/specs/ingest_provider_spec.ts on lines 65..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 81.

                        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

                                const articleDisplayWidgets = flatMap(
                                    Object.values(extensions).map(({activationResult}) => activationResult),
                                    (activationResult) =>
                                        activationResult.contributions != null
                                        && activationResult.contributions.articleListItemWidgets != null
                        Severity: Major
                        Found in scripts/apps/search/components/ListItemInfo.tsx and 2 other locations - About 2 hrs to fix
                        scripts/apps/search/components/PhotoDeskInfo.tsx on lines 21..28
                        scripts/core/menu/GlobalMenuHorizontal.tsx on lines 7..14

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

                        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

                                                            <SimpleListItem justify="space-between">
                                                                <Switch value={this.state.value2} label={{content: 'My label'}} onChange={(value) => this.setState(() => ({value2: value}))} />
                                                            </SimpleListItem>
                        Severity: Major
                        Found in scripts/apps/authoring-react/ui-framework-authoring-test.tsx and 1 other location - About 2 hrs to fix
                        scripts/apps/authoring-react/ui-framework-authoring-test.tsx on lines 363..365

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

                        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

                                    {
                                        Array.isArray(fieldsRight) === true && fieldsRight.length > 0 ? (
                                            <div className="sd-grid-item__footer-block sd-grid-item__footer-block--multi-r">
                                                <PhotoDeskFields
                                                    fieldsConfig={fieldsRight}
                        Severity: Major
                        Found in scripts/apps/search/components/PhotoDeskFooter.tsx and 1 other location - About 2 hrs to fix
                        scripts/apps/search/components/PhotoDeskFooter.tsx on lines 24..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 81.

                        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