superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function validationDirective has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function validationDirective() {
    const isValid = (errors: ServerErrorsType) => errors == null || (Array.isArray(errors) && errors.length === 0);

    return {
        restrict: 'A',
Severity: Minor
Found in scripts/core/ui/ui.ts - About 1 hr to fix

    Function initializeActivities has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                        var initializeActivities = function(item) {
                            if (!item) {
                                return;
                            }
    
    
    Severity: Minor
    Found in scripts/core/activity/activity-list-directive.ts - About 1 hr to fix

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

          constructor() {
              // Filter Condition Elements
              this.filterConditionMenuButton = element(by.css('[ng-click="ctrl.changeTab(\'filter_conditions\')"]'));
              this.addNewFilterConditionButton = element(by.css('[ng-click="edit()"]'));
              this.filterConditionNameField = element(by.id('filterCondition-name'));
      Severity: Minor
      Found in e2e/client/specs/helpers/filter_conditions.ts - About 1 hr to fix

        Function onMouseEvents has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                            (function onMouseEvents(_$img) {
                                var debouncedPoiUpdateModel = _.debounce((newPoi) => {
                                    vm.updatePOI(newPoi);
                                }, 500);
        
        
        Severity: Minor
        Found in scripts/core/upload/image-crop-directive.ts - About 1 hr to fix

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

                  link: function(scope, elem) {
                      var localMediaStream = null,
                          canvas = angular.element('<canvas style="display:none"></canvas>'),
                          ctx = canvas[0].getContext('2d'),
                          tooLate = false;
          Severity: Minor
          Found in scripts/core/upload/video-capture-directive.ts - About 1 hr to fix

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

                    beforeEach(window.module(($provide) => {
                        $provide.provider('translateFilter', function() {
                            this.$get = function() {
                                return function(text) {
                                    return text;
            Severity: Major
            Found in scripts/core/list/list.spec.ts and 1 other location - About 1 hr to fix
            scripts/core/list/list-directives.spec.ts on lines 5..13

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

            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 (additionalData != null) {
                        try {
                            options.extra = {additionalData: JSON.stringify(additionalData)};
                        } catch (e) {
                            options.extra = {additionalData: 'Failed to serialize'};
            Severity: Major
            Found in scripts/core/services/logger.ts and 1 other location - About 1 hr to fix
            scripts/core/services/logger.ts on lines 24..30

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

            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

                beforeEach(window.module(($provide) => {
                    $provide.provider('translateFilter', function() {
                        this.$get = function() {
                            return function(text) {
                                return text;
            Severity: Major
            Found in scripts/core/list/list-directives.spec.ts and 1 other location - About 1 hr to fix
            scripts/core/list/list.spec.ts on lines 10..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 66.

            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 (additionalData != null) {
                        try {
                            options.extra = {additionalData: JSON.stringify(additionalData)};
                        } catch (e) {
                            options.extra = {additionalData: 'Failed to serialize'};
            Severity: Major
            Found in scripts/core/services/logger.ts and 1 other location - About 1 hr to fix
            scripts/core/services/logger.ts on lines 43..49

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

            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: {
                        imagesOriginal: '=',
                        isUpload: '=',
                        saveHandler: '=',
                        cancelHandler: '=',
            Severity: Major
            Found in scripts/apps/search/MultiImageEdit.ts and 2 other locations - About 1 hr to fix
            scripts/apps/authoring/authoring/directives/ItemAssociationDirective.ts on lines 27..40
            scripts/core/directives/TypeaheadDirective.ts on lines 37..50

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

            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: {
                            search: '&',
                            select: '&',
                            items: '=',
                            term: '=',
            Severity: Major
            Found in scripts/core/directives/TypeaheadDirective.ts and 2 other locations - About 1 hr to fix
            scripts/apps/authoring/authoring/directives/ItemAssociationDirective.ts on lines 27..40
            scripts/apps/search/MultiImageEdit.ts on lines 321..334

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

            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: {
                        rel: '=',
                        fieldName: '=',
                        item: '=',
                        editable: '<',
            scripts/apps/search/MultiImageEdit.ts on lines 321..334
            scripts/core/directives/TypeaheadDirective.ts on lines 37..50

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

            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

            const AnnotationInputBodyWithDependenciesLoaded = connectPromiseResults(() => ({
                annotationTypes: ng.get('metadata').initialize()
                    .then(() => ng.get('metadata').values.annotation_types),
            }))(AnnotationInputBody);
            scripts/core/editor3/components/annotations/AnnotationPopup.tsx on lines 99..102

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

            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

                toggleOpenTimePicker() {
                    this.setState({openTimePicker: !this.state.openTimePicker});
            
                    if (this.state.openTimePicker) {
                        // Keep the focus to enable tab navigation
            Severity: Major
            Found in scripts/core/ui/components/Form/TimeInput/index.tsx and 1 other location - About 1 hr to fix
            scripts/core/ui/components/Form/DateInput/index.tsx on lines 63..70

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

            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

                                options: [
                                    {id: 'primary', label: getTypeLabel('primary')},
                                    {id: 'success', label: getTypeLabel('success')},
                                    {id: 'warning', label: getTypeLabel('warning')},
                                    {id: 'alert', label: getTypeLabel('alert')},
            scripts/apps/authoring/media/MediaMetadataView.tsx on lines 18..23

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

            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

                            actions[groupId].map(createAction).forEach(({label, element}) => {
                                groupedItems[finalGroupId].push({label, element});
                            });
            Severity: Major
            Found in scripts/apps/search/components/actions-menu/MenuItems.tsx and 1 other location - About 1 hr to fix
            scripts/apps/search/components/actions-menu/MenuItems.tsx on lines 171..176

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

            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

                    const fields: Array<{fieldId: keyof IArticle; label: string}> = [
                        {fieldId: 'byline', label: gettext('Credit:')},
                        {fieldId: 'copyrightholder', label: gettext('Copyright holder:')},
                        {fieldId: 'usageterms', label: gettext('Assign rights:')},
                        {fieldId: 'copyrightnotice', label: gettext('Copyright notice:')},
            Severity: Major
            Found in scripts/apps/authoring/media/MediaMetadataView.tsx and 1 other location - About 1 hr to fix
            scripts/apps/system-messages/components/system-messages-settings.tsx on lines 53..58

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

            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

                function reload() {
                    if ($scope.item) {
                        commentsService.fetch($scope.item._id).then(() => {
                            $scope.comments = commentsService.comments;
                        });
            Severity: Major
            Found in scripts/apps/authoring/comments/comments.ts and 1 other location - About 1 hr to fix
            scripts/apps/authoring/widgets/widgets.ts on lines 411..417

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

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

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

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

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

            Refactorings

            Further Reading

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

            export const TextInput: React.StatelessComponent<any> = ({
                field,
                label,
                value,
                onChange,
            Severity: Major
            Found in scripts/core/ui/components/Form/TextInput.tsx and 1 other location - About 1 hr to fix
            scripts/core/ui/components/Form/SelectInput.tsx on lines 11..59

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

            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

                            actions[stackGroupId].map(createAction).forEach(({label, element}) => {
                                groupedItems[stackGroupId].push({
                                    label,
                                    element,
                                });
            Severity: Major
            Found in scripts/apps/search/components/actions-menu/MenuItems.tsx and 1 other location - About 1 hr to fix
            scripts/apps/search/components/actions-menu/MenuItems.tsx on lines 191..193

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

            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