alibaba/noform

View on GitHub
packages/next-components/src/components/Sorter.tsx

Summary

Maintainability
C
1 day
Test Coverage

Function InternalSorter has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InternalSorter = styled(forwardRef((props, ref) => {
    const { className, render,
        style,
        ascIcon = defaultAscIcon,
        descIcon = defaultDescIcon,
Severity: Minor
Found in packages/next-components/src/components/Sorter.tsx - About 1 hr to fix

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

                    <a className={`${order === 'asc' ? 'current' : ''}`}>
                        <i className={`next-icon alist-sorter asc `}
                            onClick={() => {
                                const nextOrder = setOrder('asc')
                                onSort(props.dataIndex, nextOrder)
    Severity: Major
    Found in packages/next-components/src/components/Sorter.tsx and 1 other location - About 3 hrs to fix
    packages/next-components/src/components/Sorter.tsx on lines 32..39

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

    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

                    <a className={`${order === 'desc' ? 'current' : ''}`}>
                    <i className={`next-icon alist-sorter desc  `}
                        onClick={() => {
                            const nextOrder = setOrder('desc')
                            onSort(props.dataIndex, nextOrder)
    Severity: Major
    Found in packages/next-components/src/components/Sorter.tsx and 1 other location - About 3 hrs to fix
    packages/next-components/src/components/Sorter.tsx on lines 24..31

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

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

    const defaultDescIcon = <svg viewBox="0 0 1024 1024" focusable="false" data-icon="caret-down" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"></path></svg>
    Severity: Major
    Found in packages/next-components/src/components/Sorter.tsx and 5 other locations - About 1 hr to fix
    packages/antd-components/src/components/ToggleTrigger.tsx on lines 7..7
    packages/antd-components/src/components/ToggleTrigger.tsx on lines 8..8
    packages/next-components/src/components/Sorter.tsx on lines 6..6
    packages/next-components/src/components/ToggleTrigger.tsx on lines 7..7
    packages/next-components/src/components/ToggleTrigger.tsx on lines 8..8

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

    const defaultAscIcon = <svg viewBox="0 0 1024 1024" focusable="false" data-icon="caret-up" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"></path></svg>
    Severity: Major
    Found in packages/next-components/src/components/Sorter.tsx and 5 other locations - About 1 hr to fix
    packages/antd-components/src/components/ToggleTrigger.tsx on lines 7..7
    packages/antd-components/src/components/ToggleTrigger.tsx on lines 8..8
    packages/next-components/src/components/Sorter.tsx on lines 7..7
    packages/next-components/src/components/ToggleTrigger.tsx on lines 7..7
    packages/next-components/src/components/ToggleTrigger.tsx on lines 8..8

    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

    There are no issues that match your filters.

    Category
    Status