superdesk/superdesk-client-core

View on GitHub
scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx

Summary

Maintainability
F
3 days
Test Coverage

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

    render() {
        return (
            <WithSizeObserver style={{display: 'flex', margin: -4}}>
                {({width, height}) => (
                    <VirtualListFromQuery
Severity: Major
Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx - About 1 day to fix

    File rundowns-list.tsx has 327 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import * as React from 'react';
    
    import {WithSizeObserver, ContentListItem, Label, IconButton, Menu, Alert} from 'superdesk-ui-framework/react';
    import {IRundown, IRundownFilters, IRundownItem, IRundownTemplate, IShow} from '../interfaces';
    
    
    Severity: Minor
    Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx - About 3 hrs to fix

      Function getFilters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      function getFilters(filters: IRundownFilters | undefined): ILogicalOperator | undefined {
          const queryFilters: IAndOperator['$and'] = [];
      
          if (filters?.show != null) {
              queryFilters.push({show: {$eq: filters.show}});
      Severity: Minor
      Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx - About 1 hr 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 getFilters has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getFilters(filters: IRundownFilters | undefined): ILogicalOperator | undefined {
          const queryFilters: IAndOperator['$and'] = [];
      
          if (filters?.show != null) {
              queryFilters.push({show: {$eq: filters.show}});
      Severity: Minor
      Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx - About 1 hr to fix

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

            constructor(props: IProps) {
                super(props);
        
                this.doPreview = this.doPreview.bind(this);
                this.doEdit = this.doEdit.bind(this);
        scripts/apps/authoring-react/article-widgets/suggestions.tsx on lines 143..148
        scripts/apps/authoring-react/toolbar/mark-for-desks/mark-for-desks-popover.tsx on lines 15..20
        scripts/apps/search/components/fields/translations.tsx on lines 12..17

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

        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

            if (filters?.duration?.gte != null && filters.duration.gte !== 0) {
                queryFilters.push({duration: {$gte: filters.duration.gte}});
            }
        scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 59..61

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

        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

            if (filters?.duration?.lte != null && filters.duration.lte !== 0) {
                queryFilters.push({duration: {$lte: filters.duration.lte}});
            }
        scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 55..57

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

        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

            doPreview(rundownId: IRundown['_id'], rundownItemId: IRundownItem['_id']) {
                this.props.onEditModeChange(
                    rundownId,
                    prepareForPreview(
                        this.props.rundownItemAction,
        scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 90..98

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

        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

            doEdit(rundownId: IRundown['_id'], rundownItemId: IRundownItem['_id']) {
                this.props.onEditModeChange(
                    rundownId,
                    prepareForEditing(
                        this.props.rundownItemAction,
        scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 80..88

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

        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

        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

        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

        There are no issues that match your filters.

        Category
        Status