superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function handleKey has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    handleKey(event) {
        if (querySelectorParent(event.target, 'button', {self: true}) != null) {
            // don't execute key bindings when a button inside the list item is focused.
            return;
        }
Severity: Major
Found in scripts/apps/search/components/ItemList.tsx - About 2 hrs to fix

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

                render() {
                    const {menuShowing} = this.state;
    
                    const blockKey = this.props.offsetKey.split('-')[0];
                    const warningsForBlock = spellcheckWarnings[blockKey];

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

              this.edit = (name) => this.getRow(name).then((rows) => {
                  rows[0].click();
                  rows[0].element(by.className('icon-pencil')).click();
                  browser.sleep(500);
              });
      Severity: Major
      Found in e2e/client/specs/helpers/content_filters.ts and 1 other location - About 2 hrs to fix
      e2e/client/specs/helpers/filter_conditions.ts on lines 95..99

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

      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

              } else if (vocabulary.field_type === 'urls') {
                  adapter[vocabulary._id] = {
                      getFieldV2: (fieldEditor, fieldSchema) => {
                          const fieldConfig: IUrlsFieldConfig = {};
      
      
      Severity: Major
      Found in scripts/apps/authoring-react/field-adapters/index.tsx and 1 other location - About 2 hrs to fix
      scripts/apps/authoring-react/field-adapters/index.tsx on lines 261..347

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

      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

              this.edit = (name) => this.getRow(name).then((rows) => {
                  rows[0].click();
                  rows[0].element(by.className('icon-pencil')).click();
                  browser.sleep(500);
              });
      Severity: Major
      Found in e2e/client/specs/helpers/filter_conditions.ts and 1 other location - About 2 hrs to fix
      e2e/client/specs/helpers/content_filters.ts on lines 143..147

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

      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

          constructor(props: IProps) {
              super(props);
      
              this.addAttachments = this.addAttachments.bind(this);
              this.removeAttachment = this.removeAttachment.bind(this);
      Severity: Major
      Found in scripts/apps/authoring-react/fields/attachments/editor.tsx and 1 other location - About 2 hrs to fix
      scripts/extensions/sams/src/components/sets/setListItem.tsx 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 91.

      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 actions: Array<ITopBarWidget<IRundownItemTemplateInitial>> = [
                                                              {
                                                                  availableOffline: true,
                                                                  group: 'start',
                                                                  priority: 0.1,
      scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx on lines 593..608

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

      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

              } else if (vocabulary.field_type === 'embed') {
                  adapter[vocabulary._id] = {
                      getFieldV2: (fieldEditor, fieldSchema) => {
                          const fieldConfig: IEmbedConfig = {};
      
      
      Severity: Major
      Found in scripts/apps/authoring-react/field-adapters/index.tsx and 1 other location - About 2 hrs to fix
      scripts/apps/authoring-react/field-adapters/index.tsx on lines 246..347

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

      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 actions: Array<ITopBarWidget<IRundownItem>> = [
                                                              {
                                                                  availableOffline: true,
                                                                  group: 'start',
                                                                  priority: 0.1,
      scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx on lines 537..552

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

      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

          constructor(props: IProps) {
              super(props);
      
              this.onItemClick = this.onItemClick.bind(this);
              this.onEdit = this.onEdit.bind(this);
      Severity: Major
      Found in scripts/extensions/sams/src/components/sets/setListItem.tsx and 1 other location - About 2 hrs to fix
      scripts/apps/authoring-react/fields/attachments/editor.tsx on lines 19..25

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

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

      export function WorkspaceDropdownDirective(desks, workspaces, $route, preferencesService, $location, reloadService,
          notifyConnectionService, deskNotifications, pageTitle) {
          return {
              templateUrl: 'scripts/apps/workspace/views/workspace-dropdown.html',
              link: function(scope) {
      Severity: Major
      Found in scripts/apps/workspace/directives/WorkspaceDropdownDirective.ts - About 2 hrs to fix

        Function authoringActions has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                const authoringActions: Array<IAuthoringAction> = (() => {
                    const actions = this.props.getActions?.(exposed) ?? [];
                    const coreActions: Array<IAuthoringAction> = [];
        
                    if (appConfig.features.useTansaProofing !== true) {
        Severity: Major
        Found in scripts/apps/authoring-react/authoring-react.tsx - About 2 hrs to fix

          Function spikeActivity has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function spikeActivity(data, modal, $location, multi,
              authoringWorkspace: AuthoringWorkspaceService, confirm, autosave, $rootScope) {
              // For the sake of keyboard shortcut to work consistently,
              // if the item is multi-selected, let multibar controller handle its spike
              if (!data.item || multi.count > 0 && includes(multi.getIds(), data.item._id)) {
          Severity: Major
          Found in scripts/apps/archive/index.tsx - About 2 hrs to fix

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

                    link: function(scope) {
                        var _orig = null;
            
                        scope.editRole = null;
            
            
            Severity: Major
            Found in scripts/apps/users/directives/UserRolesDirective.ts - About 2 hrs to fix

              Function handleSave has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  handleSave() {
                      const formConfig = this.props.getFormConfig(this.state.nextItem);
                      const currentFields = getFormFieldsFlat(formConfig);
                      const currentFieldsIds = currentFields.map(({field}) => field).concat('_id').concat(this.props.hiddenFields);
              
              

                Function render has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    render() {
                        const state = this.state;
                        const {authoringStorage, fieldsAdapter, storageAdapter, getLanguage, getSidePanel} = this.props;
                
                        if (state.initialized !== true) {
                Severity: Minor
                Found in scripts/apps/authoring-react/authoring-react.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 MonitoringView has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                export function MonitoringView(
                    $rootScope,
                    authoringWorkspace: AuthoringWorkspaceService,
                    pageTitle,
                    $timeout,
                Severity: Minor
                Found in scripts/apps/monitoring/directives/MonitoringView.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 DeskConfigController has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                export function DeskConfigController($scope, $controller, notify, desks, modal) {
                    // expecting $scope.desks to be defined
                
                    $scope.modalActive = false;
                    $scope.numberOfUsers = 3;
                Severity: Minor
                Found in scripts/apps/desks/controllers/DeskConfigController.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 getCriteria has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    getCriteria(param) {
                        let criteria: any = {};
                        let params = param || this.$location.search();
                        let sort = this.sort.getSort(this.sortOptions);
                
                
                Severity: Minor
                Found in scripts/apps/content-api/services/ContentAPISearchService.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 TemplatesService has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                export function TemplatesService(api, session, $q, preferencesService, privileges, desks) {
                    var PAGE_SIZE = 10;
                    var PREFERENCES_KEY = 'templates:recent';
                
                    var KILL_TEMPLATE_IGNORE_FIELDS = ['dateline', 'template_desks', 'schedule_desk',
                Severity: Minor
                Found in scripts/apps/templates/services/TemplatesService.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

                Severity
                Category
                Status
                Source
                Language