superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function getTypeFilteringComponent has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        const getTypeFilteringComponent = (compact: boolean) => {
            interface IFileTypeOption {
                label: string;
                icon?: string;
                selected: boolean;
Severity: Major
Found in scripts/core/ArticlesListByQueryWithFilters.tsx - About 2 hrs to fix

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

        render() {
            const {value} = this.props;
    
            return (
                <Spacer
    Severity: Major
    Found in scripts/core/ui/components/date-time-picker.tsx - About 2 hrs to fix

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

                  link: function(scope, element, attrs) {
                      scope.open = false;
                      scope.page = 1;
                      scope.maxPage = 0;
                      scope.items = null;
      Severity: Major
      Found in scripts/core/directives/SearchListDirective.ts - About 2 hrs to fix

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

                    actions.push({
                        label: gettext('Duplicate In Place'),
                        icon: 'icon-copy',
                        group: {
                            label: gettext('Duplicate'),
        Severity: Major
        Found in scripts/apps/search/controllers/get-bulk-actions.tsx and 1 other location - About 2 hrs to fix
        scripts/apps/search/controllers/get-bulk-actions.tsx on lines 225..237

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

        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.push({
                        label: gettext('Duplicate To'),
                        icon: 'icon-copy',
                        group: {
                            label: gettext('Duplicate'),
        Severity: Major
        Found in scripts/apps/search/controllers/get-bulk-actions.tsx and 1 other location - About 2 hrs to fix
        scripts/apps/search/controllers/get-bulk-actions.tsx on lines 239..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 77.

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

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

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

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

        Refactorings

        Further Reading

        File ItemList.tsx has 254 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* eslint-disable react/no-render-return-value */
        
        import React from 'react';
        import ReactDOM from 'react-dom';
        import _ from 'lodash';
        Severity: Minor
        Found in scripts/apps/search/directives/ItemList.tsx - About 2 hrs to fix

          File SavedSearchManageSubscribers.ts has 254 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import {
              ISavedSearch,
              updateSubscribers,
              unsubscribeUser,
              unsubscribeDesk,
          Severity: Minor
          Found in scripts/apps/search/directives/SavedSearchManageSubscribers.ts - About 2 hrs to fix

            Function ContentResults has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            export function ContentResults($location, preferencesService, packages: IPackagesService, tags, asset, search) {
                var update = {
                    'archive:view': {
                        allowed: [
                            'mgrid',
            Severity: Minor
            Found in scripts/apps/archive/directives/ContentResults.ts - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function splitterWidget has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function splitterWidget(superdesk, $timeout, $rootScope) {
                return {
                    link: function(scope, element) {
                        const MONITORING_MIN_WIDTH = 532;
                        const AUTHORING_MIN_WIDTH = 730;
            Severity: Minor
            Found in scripts/core/ui/ui.ts - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function keyBindingFn has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                keyBindingFn(e) {
                    const {key, shiftKey, ctrlKey, metaKey} = e;
                    const selectionState = this.props.editorState.getSelection();
                    const modifierKey = isMacOS() ? metaKey : ctrlKey;
            
            
            Severity: Minor
            Found in scripts/core/editor3/components/Editor3Component.tsx - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                render() {
                    const show = this.state.showUpdated;
            
                    return (
                        <WithValidation validators={showValidators}>
            Severity: Major
            Found in scripts/extensions/broadcasting/src/shows/create-show.tsx - About 2 hrs to fix

              Function showImatricsServiceErrorModal has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function showImatricsServiceErrorModal(superdesk: ISuperdesk, errors: Array<ITagUi>) {
                  const {gettext} = superdesk.localization;
              
                  showModal(({closeModal}) => (
                      <Modal
              Severity: Major
              Found in scripts/extensions/auto-tagging-widget/src/auto-tagging.tsx - About 2 hrs to fix

                Function mergeTranslationsFromExtensions has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function mergeTranslationsFromExtensions(clientDir) {
                    const translationsJsonTemp = path.join(clientDir, 'translations-json-temp');
                    const mainTranslationsDir = path.join(clientDir, 'dist/languages');
                
                    const existingTranslationFiles = new Set(
                Severity: Major
                Found in build-tools/src/extensions/translations.js - About 2 hrs to fix

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

                      render() {
                          const {gettext} = superdeskApi.localization;
                  
                          const ContentPanel = this.getContentPanelComponent();
                          const addButtonDisabled = this.props.contentPanelState === CONTENT_PANEL_STATE.CREATE ||
                  Severity: Major
                  Found in scripts/extensions/sams/src/components/sets/manageSetsModal.tsx - About 2 hrs to fix

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

                        render() {
                            const Container = this.props.container;
                            const packageItems = (this.props.value ?? []);
                            const packageItemIds = packageItems.map(({guid}) => guid);
                            const {readOnly} = this.props;
                    Severity: Major
                    Found in scripts/apps/authoring-react/fields/package-items/editor.tsx - About 2 hrs to fix

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

                          render(): JSX.Element {
                              const state = this.state;
                      
                              if (!state.initialized) {
                                  return null;
                      Severity: Major
                      Found in scripts/apps/authoring-react/toolbar/export-modal.tsx - About 2 hrs to fix

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

                            render() {
                                const {toggledFields} = this.props;
                                const themeApplies: boolean
                                    = this.props.fields.find((field) => this.props.uiTheme?.fieldTheme[field.id] != null) != null;
                                const grouped = groupItemsToRows(this.props.fields.toArray(), (field) => field.fieldConfig.width);
                        Severity: Major
                        Found in scripts/apps/authoring-react/authoring-section/authoring-section.tsx - About 2 hrs to fix

                          Function ChangeAvatarController has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function ChangeAvatarController($scope, upload, session, urls, beta, notify, _) {
                              $scope.methods = [
                                  {id: 'upload', label: gettext('Upload from computer')},
                                  {id: 'photo', label: gettext('Take a picture')},
                                  {id: 'globe', label: gettext('Use a Web URL')},
                          Severity: Major
                          Found in scripts/apps/users/controllers/ChangeAvatarController.ts - About 2 hrs to fix

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

                                    link: function(scope, elem) {
                                        const PREVIEW_HEADER_STATE = 'item_preview:header_state';
                            
                                        const setSubjectPreviewFields = () => {
                                            scope.subjectPreviewFields = content.previewFields(scope.editor, scope.fields)
                            Severity: Major
                            Found in scripts/apps/archive/directives/MediaPreview.ts - About 2 hrs to fix

                              Function ArchivedItemKill has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function ArchivedItemKill(authoring, api, notify, content) {
                                  return {
                                      templateUrl: 'scripts/apps/archive/views/archived-kill.html',
                                      scope: {
                                          item: '=',
                              Severity: Major
                              Found in scripts/apps/archive/directives/ArchivedItemKill.ts - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language