superdesk/superdesk-client-core

View on GitHub
scripts/apps/authoring-react/fields/media/config.tsx

Summary

Maintainability
F
3 days
Test Coverage

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

    render() {
        const config: IMediaConfig = this.props.config ?? {
            allowPicture: true,
            allowAudio: true,
            allowVideo: true,
Severity: Major
Found in scripts/apps/authoring-react/fields/media/config.tsx - About 3 hrs to fix

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

                    <div>
                        <div className="form-label">{gettext('Maximum items allowed')}</div>
    
                        <input
                            type="number"
    Severity: Major
    Found in scripts/apps/authoring-react/fields/media/config.tsx and 2 other locations - About 3 hrs to fix
    scripts/apps/authoring-react/fields/editor3/config.tsx on lines 31..41
    scripts/apps/authoring-react/fields/editor3/config.tsx on lines 43..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 110.

    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

                    <div>
                        <Checkbox
                            label={{text: gettext('Allow adding items that are published')}}
                            checked={config.allowedWorkflows.published}
                            onChange={(val) => {
    Severity: Major
    Found in scripts/apps/authoring-react/fields/media/config.tsx and 1 other location - About 3 hrs to fix
    scripts/apps/authoring-react/fields/media/config.tsx on lines 76..90

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

    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

                    <div>
                        <Checkbox
                            label={{text: gettext('Allow adding items that are in progress')}}
                            checked={config.allowedWorkflows.inProgress}
                            onChange={(val) => {
    Severity: Major
    Found in scripts/apps/authoring-react/fields/media/config.tsx and 1 other location - About 3 hrs to fix
    scripts/apps/authoring-react/fields/media/config.tsx on lines 92..106

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

    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

                    <div>
                        <Checkbox
                            label={{text: gettext('Show crops for pictures')}}
                            checked={config.showPictureCrops ?? false}
                            onChange={(val) => {
    Severity: Major
    Found in scripts/apps/authoring-react/fields/media/config.tsx and 1 other location - About 2 hrs to fix
    scripts/apps/authoring-react/fields/media/config.tsx on lines 108..116

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

    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

                    <div>
                        <Checkbox
                            label={{text: gettext('Show input for editing title')}}
                            checked={config.showTitleEditingInput ?? false}
                            onChange={(val) => {
    Severity: Major
    Found in scripts/apps/authoring-react/fields/media/config.tsx and 1 other location - About 2 hrs to fix
    scripts/apps/authoring-react/fields/media/config.tsx on lines 46..54

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

    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

                    <div>
                        <Checkbox
                            label={{text: gettext('Allow video')}}
                            checked={config.allowVideo}
                            onChange={(val) => {
    Severity: Major
    Found in scripts/apps/authoring-react/fields/media/config.tsx and 2 other locations - About 2 hrs to fix
    scripts/apps/authoring-react/fields/media/config.tsx on lines 36..44
    scripts/apps/authoring-react/fields/media/config.tsx on lines 66..74

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

    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

                    <div>
                        <Checkbox
                            label={{text: gettext('Allow picture')}}
                            checked={config.allowPicture}
                            onChange={(val) => {
    Severity: Major
    Found in scripts/apps/authoring-react/fields/media/config.tsx and 2 other locations - About 2 hrs to fix
    scripts/apps/authoring-react/fields/media/config.tsx on lines 56..64
    scripts/apps/authoring-react/fields/media/config.tsx on lines 66..74

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

    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

                    <div>
                        <Checkbox
                            label={{text: gettext('Allow audio')}}
                            checked={config.allowAudio}
                            onChange={(val) => {
    Severity: Major
    Found in scripts/apps/authoring-react/fields/media/config.tsx and 2 other locations - About 2 hrs to fix
    scripts/apps/authoring-react/fields/media/config.tsx on lines 36..44
    scripts/apps/authoring-react/fields/media/config.tsx on lines 56..64

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

    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