superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function getCell has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function getCell(data: IEditor3TableData, row, col, currentStyle, selection): EditorState {
    const decorator = new CompositeDecorator([LinkDecorator]);
    const {cells} = data;
    let cellEditorState;

Severity: Minor
Found in scripts/core/editor3/helpers/table.ts - About 45 mins 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

Avoid deeply nested control flow statements.
Open

                                if (key === 'required') {
                                    issuesForField.push(
                                        gettext('Field is required'),
                                    );
                                } else if (key === 'unique') {
Severity: Major
Found in scripts/core/ui/components/ListPage/generic-list-page-item-view-edit.tsx - About 45 mins to fix

    Function generatePatch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function generatePatch<T>(a: Partial<T>, b: Partial<T>, options?: IPatchingOptions): Partial<T> {
        const result = (generate(a, b) ?? {}) as Partial<T>;
    
        if (options?.undefinedEqNull === true) {
            for (const key of Object.keys(result)) {
    Severity: Minor
    Found in scripts/core/patch.ts - About 45 mins 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 resizeDraftSelection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function resizeDraftSelection(stretchLeft, stretchRight, selection, editorState, limitedToSingleBlock = false) {
        const nextLeft = getBlockAndOffset(editorState, selection, -stretchLeft, false, limitedToSingleBlock);
        const nextRight = getBlockAndOffset(editorState, selection, stretchRight, true, limitedToSingleBlock);
    
        const nextLeftOffset = nextLeft.newOffset == null ? selection.getStartOffset() : nextLeft.newOffset;
    Severity: Minor
    Found in scripts/core/editor3/helpers/resizeDraftSelection.ts - About 45 mins 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 insertEntity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function insertEntity(
        editorState: EditorState,
        draftEntityType,
        mutability,
        data,
    Severity: Minor
    Found in scripts/core/editor3/helpers/draftInsertEntity.ts - About 45 mins 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 save has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            api.save = function apiSave(resource, dest, diff, parent, params, options?: {skipPostProcessing: boolean}) {
    Severity: Minor
    Found in scripts/core/api/api-service.ts - About 45 mins to fix

      Function apiServiceFactory has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          function apiServiceFactory($injector, $q, $http, urls, _, HttpEndpointFactory) {
      Severity: Minor
      Found in scripts/core/api/api-service.ts - About 45 mins to fix

        Function SuperdeskViewController has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                function SuperdeskViewController(superdeskFlags, superdesk, $scope, $route, session, $timeout) {
        Severity: Minor
        Found in scripts/core/menu/menu.ts - About 45 mins to fix

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

                                      currentItem.dateline.date = $filter('relativeUTCTimestamp')(scope.item.dateline.located,
                                          parseInt(scope.dateline.month, 10), parseInt(scope.dateline.day, 10));
          scripts/apps/authoring/authoring/directives/ArticleEditDirective.ts on lines 323..324

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

          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 4 locations. Consider refactoring.
          Open

              if (filters?.airtime_time?.lte != null) {
                  queryFilters.push({airtime_time: {$lte: filters.airtime_time.lte}});
              }
          Severity: Major
          Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx and 3 other locations - About 45 mins to fix
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 39..41
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 47..49
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 51..53

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

          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 4 locations. Consider refactoring.
          Open

              if (filters?.airtime_date?.gte != null) {
                  queryFilters.push({airtime_date: {$gte: filters.airtime_date.gte}});
              }
          Severity: Major
          Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx and 3 other locations - About 45 mins to fix
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 39..41
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 43..45
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 51..53

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

          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 style: CSSProperties = loading
                      ? {position: 'absolute', insetInlineStart: -9999, insetBlockStart: -9999, visibility: 'hidden'}
                      : {height: '100%'};
          Severity: Minor
          Found in scripts/apps/search/components/SmoothLoaderForKey.tsx and 1 other location - About 45 mins to fix
          scripts/apps/search/components/SmoothLoader.tsx on lines 38..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 50.

          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 4 locations. Consider refactoring.
          Open

              if (filters?.airtime_date?.lte != null) {
                  queryFilters.push({airtime_date: {$lte: filters.airtime_date.lte}});
              }
          Severity: Major
          Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx and 3 other locations - About 45 mins to fix
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 39..41
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 43..45
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 47..49

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          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 style: CSSProperties = loading
                      ? {position: 'absolute', insetInlineStart: -9999, insetBlockStart: -9999, visibility: 'hidden'}
                      : {height: '100%'};
          Severity: Minor
          Found in scripts/apps/search/components/SmoothLoader.tsx and 1 other location - About 45 mins to fix
          scripts/apps/search/components/SmoothLoaderForKey.tsx on lines 50..52

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

          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 4 locations. Consider refactoring.
          Open

              if (filters?.airtime_time?.gte != null) {
                  queryFilters.push({airtime_time: {$gte: filters.airtime_time.gte}});
              }
          Severity: Major
          Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx and 3 other locations - About 45 mins to fix
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 43..45
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 47..49
          scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 51..53

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

          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

              toggle(event) {
                  if (event) {
                      event.stopPropagation();
                  }
          
          
          Severity: Minor
          Found in scripts/apps/search/components/MarkedDesksInfo.tsx and 1 other location - About 45 mins to fix
          scripts/apps/search/components/HighlightsInfo.tsx on lines 37..44

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

          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

                                  scope.item.dateline.date = $filter('relativeUTCTimestamp')(scope.item.dateline.located,
                                      parseInt(scope.dateline.month, 10), parseInt(scope.dateline.day, 10));
          scripts/apps/authoring/authoring/directives/ArticleEditDirective.ts on lines 228..229

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

          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

              toggle(event) {
                  if (event) {
                      event.stopPropagation();
                  }
          
          
          Severity: Minor
          Found in scripts/apps/search/components/HighlightsInfo.tsx and 1 other location - About 45 mins to fix
          scripts/apps/search/components/MarkedDesksInfo.tsx on lines 33..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 50.

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

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

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

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

          Refactorings

          Further Reading

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

                              onMouseEnter={() => {
                                  this.setState({
                                      displayHandle: true,
                                  }, () => {
                                      window.clearTimeout(this.timeoutId);
          scripts/core/editor3/components/media/dragable-editor3-block.tsx on lines 39..45
          scripts/core/editor3/components/media/dragable-editor3-block.tsx on lines 60..66

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

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

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

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

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

          Refactorings

          Further Reading

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

                          s: d3.scale
                              .linear()
                              .domain([0, 59 + 999 / 1000])
                              .range([0, 2 * pi]),
          Severity: Major
          Found in scripts/apps/dashboard/world-clock/world-clock.ts and 2 other locations - About 45 mins to fix
          scripts/apps/dashboard/world-clock/world-clock.ts on lines 100..103
          scripts/apps/dashboard/world-clock/world-clock.ts on lines 104..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 50.

          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