superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

    const newSelection = selection.merge({
        anchorOffset: selection.getEndOffset(),
        anchorKey: selection.getEndKey(),
        focusOffset: selection.getEndOffset(),
        focusKey: selection.getEndKey(),
Severity: Major
Found in scripts/core/editor3/reducers/toolbar.tsx and 1 other location - About 1 hr to fix
scripts/core/editor3/reducers/suggestions.tsx on lines 430..437

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

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

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

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

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

Refactorings

Further Reading

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

        this.tree.find('iframe').each((i, node) => {
            this.iframes[i] = node.outerHTML;
            $(node).replaceWith(`<figure>BLOCK_IFRAME_${i}</figure>`);
        });
Severity: Major
Found in scripts/core/editor3/html/from-html/index.ts and 1 other location - About 1 hr to fix
scripts/core/editor3/html/from-html/index.ts on lines 141..144

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

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

    initiateCreation(
        rundownId: IRundown['_id'],
        initialData: Partial<IRundownItemBase>,
        insertAtIndex?: number,
        skipUnsavedChangesCheck?: boolean,
Severity: Minor
Found in scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx - About 1 hr to fix

    Function updateSetsAllowedDesks has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function updateSetsAllowedDesks(setId: ISetItem['_id'], allowedDesks: Array<IDesk['_id']>): Promise<void> {
        const store = getStoreSync();
        const currentlyAllowed: Array<IDesk['_id']> = getDesksAllowedSets(store.getState())[setId] ?? [];
        const toRemove = currentlyAllowed.filter(
            (deskId) => !allowedDesks.includes(deskId),
    Severity: Minor
    Found in scripts/extensions/sams/src/api/workspace.ts - About 1 hr to fix

      Function getDifferenceStatistics has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getDifferenceStatistics<T>(
          items1: Array<T>,
          items2: Array<T>,
          getId: (item: T) => string,
          isEqual: (item1: T, item2: T) => boolean,
      Severity: Minor
      Found in scripts/apps/authoring-react/fields/difference-statistics.ts - About 1 hr to fix

        Function SortGroups has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function SortGroups() {
            return {
                link: function(scope, element) {
                    var updated = false;
        
        
        Severity: Minor
        Found in scripts/apps/monitoring/directives/SortGroups.ts - About 1 hr to fix

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

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

            Function getCriteria has 47 lines of code (exceeds 25 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 1 hr to fix

              Function AuthoringWidgetsDir has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function AuthoringWidgetsDir(desks, commentsService, $injector) {
                  return {
                      controller: WidgetsManagerCtrl,
                      templateUrl: 'scripts/apps/authoring/widgets/views/authoring-widgets.html',
                      transclude: true,
              Severity: Minor
              Found in scripts/apps/authoring/widgets/widgets.ts - About 1 hr to fix

                Function getCriteria has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        this.getCriteria = function getCriteria(withSource) {
                            let search = params;
                            let sort = sortService.getSort(sortOptions);
                
                            setParameters(filters, params);
                Severity: Minor
                Found in scripts/apps/search/services/SearchService.ts - About 1 hr to fix

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

                      render() {
                          const items: Array<{id: string; label: string}> = this.props.formField.component_parameters.items;
                  
                          if (this.props.previewOutput) {
                              if (this.props.value == null) {

                    Function getMultiSelectToolbar has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                        const getMultiSelectToolbar = (articles: Array<IArticle>) => {
                                            const getSelectedItems = () => articles;
                                            const unselectAll = () => multiSelectOptions.unselectAll();
                    
                                            const multiActions = getMultiActions(
                    Severity: Minor
                    Found in scripts/core/ArticlesListByQueryWithFilters.tsx - About 1 hr to fix

                      Function addHighlight has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function addHighlight(editorState, type, data, single = false) {
                          let nextEditorState = editorState;
                      
                          const initialSelection = nextEditorState.getSelection().merge({
                              hasFocus: true,
                      Severity: Minor
                      Found in scripts/core/editor3/helpers/highlights.ts - About 1 hr to fix

                        Function WidgetsManagerCtrl has 15 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            $scope: IScope,
                            $routeParams,
                            authoringWidgets: Array<IWidget>,
                            archiveService,
                            authoringWorkspace: AuthoringWorkspaceService,
                        Severity: Major
                        Found in scripts/apps/authoring/widgets/widgets.ts - About 1 hr to fix

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

                                      <button
                                          className={className}
                                          ref={this.elem}
                                          onClick={() => {
                                              if (this.input.current != null) {
                          Severity: Major
                          Found in scripts/core/ui/components/drop-zone.tsx and 1 other location - About 1 hr to fix
                          scripts/apps/vocabularies/components/drop-zone.tsx on lines 59..97

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

                          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

                                                                  const allGroupedAndSortedByConfig = allGrouped
                                                                      .filter((_, key) => hasConfig(key, this.iMatricsFields.others))
                                                                      .sortBy((_, key) => this.iMatricsFields.others[key].order,
                                                                          (a, b) => a - b);
                          Severity: Major
                          Found in scripts/extensions/auto-tagging-widget/src/auto-tagging.tsx and 1 other location - About 1 hr to fix
                          scripts/extensions/auto-tagging-widget/src/header-auto-tagging.tsx on lines 74..77

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

                          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

                                      const allGroupedAndSortedByConfig = allGrouped
                                          .filter((_, key) => hasConfig(key, this.iMatricsFields.others))
                                          .sortBy((_, key) => this.iMatricsFields.others[key].order,
                                              (a, b) => a - b);
                          scripts/extensions/auto-tagging-widget/src/auto-tagging.tsx on lines 722..725

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

                          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

                                      <button
                                          className={className}
                                          ref={this.elem}
                                          onClick={() => {
                                              if (this.input.current != null) {
                          Severity: Major
                          Found in scripts/apps/vocabularies/components/drop-zone.tsx and 1 other location - About 1 hr to fix
                          scripts/core/ui/components/drop-zone.tsx on lines 78..107

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

                          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 {
                                  newSelection = selection.merge({
                                      anchorOffset: selection.getStartOffset(),
                                      anchorKey: selection.getStartKey(),
                                      focusOffset: selection.getStartOffset(),
                          Severity: Major
                          Found in scripts/core/editor3/helpers/selection/selectionIterator.ts and 1 other location - About 1 hr to fix
                          scripts/core/editor3/helpers/selection/selectionIterator.ts on lines 14..22

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

                          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

                          interface IProps {
                              container: React.ComponentType<IEditorComponentContainerProps>;
                              config: IDropdownTreeConfig;
                              value: IDropdownValue;
                              language: string;
                          scripts/apps/authoring-react/fields/dropdown/dropdown-remote-source/editor.tsx on lines 5..12

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

                          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