superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function buildFilters has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function buildFilters(paramsObject: any, query) {
            // date filters start
            var facetrange = {};

            const dateRangesByKey = getDateRangesByKey();
Severity: Minor
Found in scripts/apps/search/services/SearchService.ts - About 1 hr to fix

    Function getComponent has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        getComponent(val, index = 0) {
            const {readOnly, onFocus, field, createLink} = this.props;
    
            return readOnly ? (
                <Row key={index} noPadding>
    Severity: Minor
    Found in scripts/core/ui/components/Form/FileInput.tsx - About 1 hr to fix

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

              render() {
                  if (this.props.previewOutput) {
                      if (this.props.value == null) {
                          logger.warn('previewOutput is enabled but the value is null', this.props.formField);
                          return null;

        Function insertAtomicBlockWithoutEmptyLines has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function insertAtomicBlockWithoutEmptyLines(
            editorState: EditorState,
            entityKey: string,
            character: string,
        ): { editorState: EditorState, blockKey: string } {
        Severity: Minor
        Found in scripts/core/editor3/helpers/insertAtomicBlockWithoutEmptyLines.ts - About 1 hr to fix

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

              constructor() {
                  // Content Filters Elements
                  this.addNewContentFilterButton = element(by.css('[ng-click="editFilter()"]'));
                  this.contentFilterMenuButton = element(by.css('[ng-click="ctrl.changeTab(\'filters\')"]'));
                  this.contentFilterNameField = element(by.id('contentFilter-name'));
          Severity: Minor
          Found in e2e/client/specs/helpers/content_filters.ts - About 1 hr to fix

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

                fetchArticleFromServer() {
                    // fetching original item from the server since `IProps['article']` contains changes
                    // which it shouldn't contain since it is in read-only mode.
                    // I've tried passing `origItem` from authoring-topbar, but it contains changes as well,
                    // namely `_editable` and `_locked` fields which doesn't allow for computing correct diff.
            Severity: Major
            Found in scripts/apps/authoring/authoring/authoring-topbar-react.tsx and 1 other location - About 1 hr to fix
            scripts/apps/authoring/authoring/authoring-topbar2-react.tsx on lines 32..40

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

            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

                fetchArticleFromServer() {
                    // fetching original item from the server since `IProps['article']` contains changes
                    // which it shouldn't contain since it is in read-only mode.
                    // I've tried passing `origItem` from authoring-topbar, but it contains changes as well,
                    // namely `_editable` and `_locked` fields which doesn't allow for computing correct diff.
            scripts/apps/authoring/authoring/authoring-topbar-react.tsx on lines 29..37

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

            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

                getFieldV2: (fieldEditor, fieldSchema) => {
                    const fieldConfig: IDropdownConfigVocabulary = {
                        source: 'vocabulary',
                        vocabularyId: 'languages',
                        multiple: false,
            Severity: Major
            Found in scripts/apps/authoring-react/field-adapters/language.ts and 1 other location - About 1 hr to fix
            scripts/apps/authoring-react/field-adapters/keywords.ts on lines 16..31

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

            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

                            $scope.fileTypes = [
                                {
                                    type: 'text',
                                    icon: 'icon-text',
                                },
            Severity: Major
            Found in scripts/apps/ingest/directives/IngestSourcesContent.ts and 1 other location - About 1 hr to fix
            scripts/apps/authoring/authoring/services/AuthoringThemesService.ts on lines 37..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 74.

            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 MainColumn: React.StatelessComponent<any> = ({children, padded}) => (
                <div
                    className={classNames(
                        'sd-column-box__main-column',
                        {'sd-column-box__main-column--padded': padded},
            Severity: Major
            Found in scripts/core/ui/components/ColumnBox/MainColumn.tsx and 1 other location - About 1 hr to fix
            scripts/core/ui/components/List/ActionMenu.tsx on lines 10..19

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

            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

                    colors: [
                        {
                            label: 'Default',
                            key: 'default',
                        },
            scripts/apps/ingest/directives/IngestSourcesContent.ts on lines 93..118

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

            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

                        getFieldV2: () => {
                            const fieldConfig: IDropdownConfigVocabulary = {
                                source: 'vocabulary',
                                vocabularyId: 'keywords',
                                multiple: true,
            Severity: Major
            Found in scripts/apps/authoring-react/field-adapters/keywords.ts and 1 other location - About 1 hr to fix
            scripts/apps/authoring-react/field-adapters/language.ts on lines 5..20

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

            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

                                <ProofreadingThemePanel
                                    theme={this.state.proofReadingTheme}
                                    title={gettext('Proofreading Theme')}
                                    badgeColor="grey"
                                    onChange={(theme: ITheme) => {
            scripts/apps/authoring-react/toolbar/proofreading-theme-modal.tsx on lines 95..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 74.

            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

            Item.propTypes = {
                svc: PropTypes.object.isRequired,
                scope: PropTypes.object.isRequired,
                item: PropTypes.object,
                flags: PropTypes.object,
            Severity: Major
            Found in scripts/apps/contacts/components/Item.tsx and 1 other location - About 1 hr to fix
            scripts/apps/contacts/components/Form/ProfileDetail.tsx on lines 672..679

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

            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

                        scope.editDeskSubscription = (desk: IDesk) => {
                            scope.wrapper.subscriptionInCreateOrEditMode = scope.savedSearch.subscribers.desk_subscriptions.find(
                                (subscription) => subscription.desk === desk._id,
                            );
                        };
            scripts/apps/search/directives/SavedSearchManageSubscribers.ts on lines 236..240

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

            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

                                <ProofreadingThemePanel
                                    theme={this.state.defaultTheme}
                                    title={gettext('Default Theme')}
                                    badgeColor="green"
                                    onChange={(theme: ITheme) => {
            scripts/apps/authoring-react/toolbar/proofreading-theme-modal.tsx on lines 103..110

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

            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

            ProfileDetail.propTypes = {
                svc: PropTypes.object.isRequired,
                contact: PropTypes.object.isRequired,
                contactType: PropTypes.string,
                onChange: PropTypes.func,
            Severity: Major
            Found in scripts/apps/contacts/components/Form/ProfileDetail.tsx and 1 other location - About 1 hr to fix
            scripts/apps/contacts/components/Item.tsx on lines 104..111

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

            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

                        scope.editUserSubscription = (user: IUser) => {
                            scope.wrapper.subscriptionInCreateOrEditMode = scope.savedSearch.subscribers.user_subscriptions.find(
                                (subscription) => subscription.user === user._id,
                            );
                        };
            scripts/apps/search/directives/SavedSearchManageSubscribers.ts on lines 242..246

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

            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 ActionMenu: React.StatelessComponent<any> = ({children, row}) => (
                <div
                    className={classNames(
                        'sd-list-item__action-menu',
                        {'sd-list-item__action-menu--direction-row': row},
            Severity: Major
            Found in scripts/core/ui/components/List/ActionMenu.tsx and 1 other location - About 1 hr to fix
            scripts/core/ui/components/ColumnBox/MainColumn.tsx on lines 11..20

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

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

                render() {
                    const {gettext} = this.props.superdesk.localization;
            
                    const backButton = (
                        <div className="space-between" style={{marginBlockStart: 15}}>
            Severity: Minor
            Found in scripts/extensions/annotationsLibrary/src/AnnotationsSelect.tsx - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language