alibaba/noform

View on GitHub

Showing 217 of 217 total issues

Function createList has 589 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createList(props: IListProps = {}): IList {
  // 渲染相关的设置都在API层完成,core层只管数据,和操作数据的方法
  const list = new ListCore(props)
  const lifeCycles = new LifeCylcesCore({ lifeCycles: props.lifeCycles })

Severity: Major
Found in packages/core/src/index.ts - About 2 days to fix

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

            setRowSelection: (selectionConfig: IListSelectionConfig) => {
                actionsRef.current.setSelectionConfig(selectionConfig)
                const config = actionsRef.current.getSelectionConfig()                
                const { className = '' } = actionsRef.current.getTableProps()
                if (config) {                    
    Severity: Major
    Found in packages/antd-components/src/hooks/useAntdList.ts and 1 other location - About 2 days to fix
    packages/antd/src/hooks/useAntdList.ts on lines 29..78

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

    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

            setRowSelection: (selectionConfig: IListSelectionConfig) => {
                actionsRef.current.setSelectionConfig(selectionConfig)
                const config = actionsRef.current.getSelectionConfig()                
                const { className = '' } = actionsRef.current.getTableProps()
                if (config) {                    
    Severity: Major
    Found in packages/antd/src/hooks/useAntdList.ts and 1 other location - About 2 days to fix
    packages/antd-components/src/hooks/useAntdList.ts on lines 45..94

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

    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 createList has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
    Open

    function createList(props: IListProps = {}): IList {
      // 渲染相关的设置都在API层完成,core层只管数据,和操作数据的方法
      const list = new ListCore(props)
      const lifeCycles = new LifeCylcesCore({ lifeCycles: props.lifeCycles })
    
    
    Severity: Minor
    Found in packages/core/src/index.ts - About 2 days 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

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

    const SchemaTable = (props) => {
        const { schema, children } = props
        const componentProps = schema.getExtendsComponentProps()
        const { columns, ...others } = componentProps
        if (columns) {
    Severity: Major
    Found in packages/antd-components/src/components/Table.tsx and 1 other location - About 1 day to fix
    packages/next-components/src/components/Table.tsx on lines 305..335

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

    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 SchemaTable = (props) => {
        const { schema, children } = props
        const componentProps = schema.getExtendsComponentProps()
        const { columns, ...others } = componentProps
        if (columns) {
    Severity: Major
    Found in packages/next-components/src/components/Table.tsx and 1 other location - About 1 day to fix
    packages/antd-components/src/components/Table.tsx on lines 263..292

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

    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

    File index.ts has 613 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import ListCore from './model/core'
    import LifeCylcesCore, { ListLifeCycle } from './model/lifeCycles'
    import {
      IList,
      IListFunctionOptions,
    Severity: Major
    Found in packages/core/src/index.ts - About 1 day to fix

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

      const pickupFieldProps = (props) => {
          const ignoreKeys = ['children']
          const commonKeys = ['required']
          const fieldPropsKeys = ['triggerType', 'name', 'value', 'initialValue', 'props', 'rules', 'editable', 'onChange']
          const result = {
      Severity: Major
      Found in packages/next/src/components/Filter.tsx and 1 other location - About 1 day to fix
      packages/antd/src/components/Filter.tsx on lines 19..42

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

      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

      const pickupFieldProps = (props) => {
          const ignoreKeys = ['children']
          const commonKeys = ['required']
          const fieldPropsKeys = ['triggerType', 'name', 'value', 'initialValue', 'props', 'rules', 'editable', 'onChange']
          const result = {
      Severity: Major
      Found in packages/antd/src/components/Filter.tsx and 1 other location - About 1 day to fix
      packages/next/src/components/Filter.tsx on lines 20..43

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

      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

      const Item = (props) => {
          const { children } = props
          const { field, others } = pickupFieldProps(props)
      
          return <FieldProvider name={props.name}>
      Severity: Major
      Found in packages/next/src/components/Filter.tsx and 1 other location - About 1 day to fix
      packages/antd/src/components/Filter.tsx on lines 44..70

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

      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

      const Item = (props) => {
          const { children } = props
          const { field, others } = pickupFieldProps(props)
          return <FieldProvider name={props.name}>
              {({ mode }) => {
      Severity: Major
      Found in packages/antd/src/components/Filter.tsx and 1 other location - About 1 day to fix
      packages/next/src/components/Filter.tsx on lines 45..72

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

      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

      const InternalClear = (props) => {
          const { form, render, children, content, ...others } = props
          return <Consumer>
              {(list) => {            
                  if (list) {
      Severity: Major
      Found in packages/antd-components/src/components/Clear.tsx and 3 other locations - About 1 day to fix
      packages/antd-components/src/components/Reset.tsx on lines 6..29
      packages/next-components/src/components/Clear.tsx on lines 6..29
      packages/next-components/src/components/Reset.tsx on lines 6..29

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

      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

      const InternalClear = (props) => {
          const { form, render, children, content, ...others } = props
          return <Consumer>
              {(list) => {            
                  if (list) {
      Severity: Major
      Found in packages/next-components/src/components/Clear.tsx and 3 other locations - About 1 day to fix
      packages/antd-components/src/components/Clear.tsx on lines 6..29
      packages/antd-components/src/components/Reset.tsx on lines 6..29
      packages/next-components/src/components/Reset.tsx on lines 6..29

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

      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

      const InternalReset = (props) => {
          const { form, render, content, children, ...others } = props
          return <Consumer>
              {(list) => {            
                  if (list) {
      Severity: Major
      Found in packages/next-components/src/components/Reset.tsx and 3 other locations - About 1 day to fix
      packages/antd-components/src/components/Clear.tsx on lines 6..29
      packages/antd-components/src/components/Reset.tsx on lines 6..29
      packages/next-components/src/components/Clear.tsx on lines 6..29

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

      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

      const InternalReset = (props) => {
          const { form, render, content, children, ...others } = props
          return <Consumer>
              {(list) => {            
                  if (list) {
      Severity: Major
      Found in packages/antd-components/src/components/Reset.tsx and 3 other locations - About 1 day to fix
      packages/antd-components/src/components/Clear.tsx on lines 6..29
      packages/next-components/src/components/Clear.tsx on lines 6..29
      packages/next-components/src/components/Reset.tsx on lines 6..29

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

      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 useToggle has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
      Open

      export const useToggle = (props) => {
          const { defaultOpen, defaultOpenAll, toggleeKey, multipleId: propsMultipleId } = props
          const { list, tableProps } = useContext(TableContext)
          const { id: contextMultipleId } = useContext(MultipleContext) || {}
          const multipleId = propsMultipleId || contextMultipleId
      Severity: Minor
      Found in packages/react/src/hooks/useToggle.ts - About 7 hrs 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

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

      const InternalExpandTrigger = (props) => {
          const { render, expandText, unExpandText, ...others } = props
      
          return <FormSpy selector={[]}>
            {({ form }) => {
      Severity: Major
      Found in packages/antd-components/src/components/ExpandTrigger.tsx and 1 other location - About 7 hrs to fix
      packages/next-components/src/components/ExpandTrigger.tsx on lines 6..23

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

      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 InternalExpandTrigger = (props) => {
          const { render, expandText, unExpandText, ...others } = props
      
          return <FormSpy selector={[]}>
            {({ form }) => {
      Severity: Major
      Found in packages/next-components/src/components/ExpandTrigger.tsx and 1 other location - About 7 hrs to fix
      packages/antd-components/src/components/ExpandTrigger.tsx on lines 6..23

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

      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

                  return <Button
                      loading={enableLoading ? list ? list.getLoading() : loading : undefined}
                      type="primary"
                      {...others}
                      onClick={(...args) => {
      Severity: Major
      Found in packages/next-components/src/components/Search.tsx and 1 other location - About 7 hrs to fix
      packages/antd-components/src/components/Search.tsx on lines 37..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 176.

      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

                  return <Button
                      loading={enableLoading ? list ? list.getLoading() : loading : undefined}
                      type="primary"
                      {...others}
                      onClick={(...args) => {
      Severity: Major
      Found in packages/antd-components/src/components/Search.tsx and 1 other location - About 7 hrs to fix
      packages/next-components/src/components/Search.tsx on lines 37..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 176.

      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