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

    onDelete(event: any) {
        if (this.props.deleteSet) {
            event.stopPropagation();
            this.props.deleteSet(this.props.set);
        }
Severity: Major
Found in scripts/extensions/sams/src/components/sets/setListItem.tsx and 1 other location - About 1 hr to fix
scripts/extensions/sams/src/components/sets/setListItem.tsx on lines 39..44

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

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

                            {
                                primaryColumnShown && (
                                    <div style={scrollableColumnCss}>
                                        <PreviewAuthoringItem
                                            item={entity1}
scripts/apps/authoring-react/compare-articles/compare-articles.tsx on lines 181..192

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

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

            return samsApi.assets.lockAsset(asset, {'lock_action': 'edit'})
                .then((lockedAsset: Partial<IAssetItem>) => {
                    dispatch(updateAssetInStore(lockedAsset, asset._id));
                    const getassets = getAssets(getState());

Severity: Major
Found in scripts/extensions/sams/src/store/assets/actions.ts and 2 other locations - About 1 hr to fix
scripts/extensions/sams/src/store/assets/actions.ts on lines 233..239
scripts/extensions/sams/src/store/assets/actions.ts on lines 245..251

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

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

        scope: {
            list: '=',
            disabled: '=ngDisabled',
            item: '=',
            field: '@',
Severity: Major
Found in scripts/apps/authoring/metadata/metadata.ts and 2 other locations - About 1 hr to fix
scripts/apps/authoring/authoring/directives/ItemCarouselDirective.ts on lines 61..73
scripts/apps/authoring/media/MediaMetadataEditorDirective.ts on lines 6..18

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

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

                            {
                                secondaryColumnShown && (
                                    <div style={scrollableColumnCss}>
                                        <PreviewAuthoringItem
                                            item={entity2}
scripts/apps/authoring-react/compare-articles/compare-articles.tsx on lines 168..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 61.

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

        getAndMergeRelatedEntitiesForArticles(
            updatedItems,
            this.state.relatedEntities,
            this.abortController.signal,
        ).then((relatedEntities) => {
Severity: Major
Found in scripts/apps/search/components/ItemListAngularWrapper.tsx and 1 other location - About 1 hr to fix
scripts/core/itemList/items-list-limited.tsx on lines 73..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 61.

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.getSelectedContentProfiles = function(): string {
        return this.activeFilters.contentProfile.length === 0 ? null
            : JSON.stringify(this.activeFilters.contentProfile);
    };
Severity: Major
Found in scripts/apps/monitoring/controllers/AggregateCtrl.ts and 1 other location - About 1 hr to fix
scripts/apps/monitoring/controllers/AggregateCtrl.ts on lines 368..370

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

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

export const Button: React.StatelessComponent<any> = ({
    className,
    onClick,
    icon,
    tooltip,
Severity: Major
Found in scripts/core/ui/components/Nav/Button.tsx and 2 other locations - About 1 hr to fix
scripts/core/ui/components/Form/Input.tsx on lines 9..49
scripts/core/ui/components/Form/TextAreaInput.tsx on lines 14..46

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

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

                    getAndMergeRelatedEntitiesForArticles(
                        items,
                        this.state.relatedEntities,
                        this.abortController.signal,
                    ).then((relatedEntities) => {
Severity: Major
Found in scripts/core/itemList/items-list-limited.tsx and 1 other location - About 1 hr to fix
scripts/apps/search/components/ItemListAngularWrapper.tsx on lines 147..156

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

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

    onEdit(event: any) {
        if (this.props.editSet) {
            event.stopPropagation();
            this.props.editSet(this.props.set);
        }
Severity: Major
Found in scripts/extensions/sams/src/components/sets/setListItem.tsx and 1 other location - About 1 hr to fix
scripts/extensions/sams/src/components/sets/setListItem.tsx on lines 46..51

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

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

    render() {
        const classes = classNames(
            'sd-grid-item__thumb',
            {
                'sd-grid-item__thumb--uploading': this.props.uploading,
Severity: Minor
Found in scripts/extensions/sams/src/ui/grid/GritItemThumb.tsx - About 1 hr to fix

    Function watch has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function getActions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          return function getActions(article: IArticle): Array<IAuthoringAction> {
              if (!canChangeMarkedUser(superdesk, article)) {
                  return [];
              }
      
      
      Severity: Minor
      Found in scripts/extensions/markForUser/src/get-article-actions.tsx - About 1 hr to fix

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

                    render() {
                        const {item, page} = this.props;
        
                        return (
                            <ListItem onClick={() => page.openPreview(item._id)}>
        Severity: Minor
        Found in scripts/extensions/broadcasting/src/shows/manage-shows.tsx - About 1 hr to fix

          Function el has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function el(
              testIds: Array<string> | null = null,
              byLocator: Locator | null = null, // example: by.cssContainingText('option', 'Text')
              parent: ElementFinder | null = null,
          ): ElementFinder {
          Severity: Minor
          Found in end-to-end-testing-helpers/index.ts - About 1 hr to fix

            Function save has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        $scope.save = function() {
                            $scope.subscriber.destinations = $scope.destinations;
            
                            let diff = {};
            
            
            Severity: Minor
            Found in scripts/apps/publish/directives/SubscribersDirective.ts - About 1 hr to fix

              Function selectQueuedItem has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  $scope.selectQueuedItem = function(queuedItem) {
                      if (queuedItem.selected) {
                          $scope.selectedQueueItems = _.union($scope.selectedQueueItems, [queuedItem]);
                      } else {
                          $scope.selectedQueueItems = _.without($scope.selectedQueueItems, queuedItem);
              Severity: Minor
              Found in scripts/apps/publish/controllers/PublishQueueController.ts - About 1 hr to fix

                Function handleClick has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    handleClick() {
                        this.setState(
                            {
                                type: 'capture',
                                value: this.props.video.currentTime,
                Severity: Minor
                Found in scripts/extensions/videoEditor/src/VideoEditorThumbnail.tsx - About 1 hr to fix

                  Function move has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              scope.move = function(diff, event) {
                                  if (!_.isNil(scope.selected) && $rootScope.config.features.customMonitoringWidget && scope.itemIds) {
                                      var itemId = scope.generateTrackByIdentifier(scope.selected);
                                      var index = scope.itemIds.findIndex((x) => x === itemId);
                  
                  
                  Severity: Minor
                  Found in scripts/apps/monitoring/directives/WidgetGroup.ts - About 1 hr to fix

                    Function constructor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        constructor(props: IProps) {
                            super(props);
                    
                            this.sortFields = this.props.schemaFields.map((field) => field.key);
                            this.lastId = 0;
                    Severity: Minor
                    Found in scripts/apps/vocabularies/components/VocabularyItemsViewEdit.tsx - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language