seerline/clchart

View on GitHub
src/data/cl.data.tools.js

Summary

Maintainability
F
1 wk
Test Coverage

File cl.data.tools.js has 482 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Copyright (c) 2018-present clchart Contributors.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
Severity: Minor
Found in src/data/cl.data.tools.js - About 7 hrs to fix

    Function transExrightDay has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    export function transExrightDay (days, rights, mode, start, end) {
      if (rights.length < 1 || days.length < 1) return days
      if (mode === undefined) mode = 'forword' // 以最近的价格为基准,修正以前的价格;
      if (start === undefined || start < 0 || start > days.length - 1) start = 0
      if (end === undefined || end < 0) end = days.length - 1
    Severity: Minor
    Found in src/data/cl.data.tools.js - About 2 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

    Function transExrightMin has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    export function transExrightMin (days, rights, mode, start, end) {
      if (rights.length < 1 || days.length < 1) return days
      if (mode === undefined) mode = 'forword' // 以最近的价格为基准,修正以前的价格;
      if (start === undefined || start < 0 || start > days.length - 1) start = 0
      if (end === undefined || end < 0) end = days.length - 1
    Severity: Minor
    Found in src/data/cl.data.tools.js - About 2 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

    Function getZipDay has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getZipDay (daydata, rate) {
      if (rate < 1) return daydata
      const out = []
      const zipday = []
    
    
    Severity: Minor
    Found in src/data/cl.data.tools.js - About 2 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

    Function getValue has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function getValue ({
      fields,
      value
    }, label, index = 0) {
      let val = 0
    Severity: Minor
    Found in src/data/cl.data.tools.js - 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 checkMDay has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function checkMDay (source, tradeDate, tradetime) {
      const out = []
      if (source.length < 1) return out
    
      const lastDate = getDate(source[source.length - 1][FIELD_MDAY.time])
    Severity: Minor
    Found in src/data/cl.data.tools.js - About 1 hr to fix

      Function matchDayToWeek has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      export function matchDayToWeek (daydata) {
        const out = []
        const zipday = []
      
        const field = FIELD_DAY
      Severity: Minor
      Found in src/data/cl.data.tools.js - 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 matchDayToMon has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      export function matchDayToMon (daydata) {
        let month
        const out = []
        const zipday = []
      
      
      Severity: Minor
      Found in src/data/cl.data.tools.js - 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 fromTradeTimeToIndex has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export function fromTradeTimeToIndex (ttime, tradetime) { // time_t 返回0-239
        const minute = getMinute(ttime)
      
        let nowmin = 0
        let index = -1
      Severity: Minor
      Found in src/data/cl.data.tools.js - 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 getZipDay has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getZipDay (daydata, rate) {
        if (rate < 1) return daydata
        const out = []
        const zipday = []
      
      
      Severity: Minor
      Found in src/data/cl.data.tools.js - About 1 hr to fix

        Function matchDayToMon has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function matchDayToMon (daydata) {
          let month
          const out = []
          const zipday = []
        
        
        Severity: Minor
        Found in src/data/cl.data.tools.js - About 1 hr to fix

          Function matchDayToWeek has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function matchDayToWeek (daydata) {
            const out = []
            const zipday = []
          
            const field = FIELD_DAY
          Severity: Minor
          Found in src/data/cl.data.tools.js - About 1 hr to fix

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

            export function checkMDay (source, tradeDate, tradetime) {
              const out = []
              if (source.length < 1) return out
            
              const lastDate = getDate(source[source.length - 1][FIELD_MDAY.time])
            Severity: Minor
            Found in src/data/cl.data.tools.js - 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

            Consider simplifying this complex logical expression.
            Open

              if (Array.isArray(value) &&
                value[fields.open] > 0 &&
                value[fields.high] > 0 &&
                value[fields.low] > 0 &&
                value[fields.close] > 0 &&
            Severity: Major
            Found in src/data/cl.data.tools.js - About 1 hr to fix

              Function transExrightMin has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              export function transExrightMin (days, rights, mode, start, end) {
              Severity: Minor
              Found in src/data/cl.data.tools.js - About 35 mins to fix

                Function _transExright has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function _transExright (days, rightdata, mode, start, end) {
                Severity: Minor
                Found in src/data/cl.data.tools.js - About 35 mins to fix

                  Function transExrightDay has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  export function transExrightDay (days, rights, mode, start, end) {
                  Severity: Minor
                  Found in src/data/cl.data.tools.js - About 35 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return index
                    Severity: Major
                    Found in src/data/cl.data.tools.js - About 30 mins to fix

                      Function getExrightPriceRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function getExrightPriceRange (start, stop, price, rights) {
                        if (rights === undefined || rights.length < 1) return price
                        let rightpara
                        for (let j = 0; j < rights.length; j++) {
                          if (rights[j][0] > start && rights[j][0] <= stop) {
                      Severity: Minor
                      Found in src/data/cl.data.tools.js - About 25 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

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

                          if (isBegin) {
                            zipday[field.open] = daydata[k][field.open]
                            zipday[field.high] = daydata[k][field.high]
                            zipday[field.low] = daydata[k][field.low]
                            month = getDayMon(daydata[k][field.time])
                      Severity: Major
                      Found in src/data/cl.data.tools.js and 1 other location - About 5 hrs to fix
                      src/data/cl.data.tools.js on lines 717..727

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

                      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

                          if (isBegin) {
                            zipday[field.open] = daydata[k][field.open]
                            zipday[field.high] = daydata[k][field.high]
                            zipday[field.low] = daydata[k][field.low]
                            isBegin = false
                      Severity: Major
                      Found in src/data/cl.data.tools.js and 1 other location - About 5 hrs to fix
                      src/data/cl.data.tools.js on lines 763..774

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

                      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

                      export function getValueMin (data, label, value) {
                        let out = value
                        if (!Array.isArray(data.value)) return out
                        for (let k = 0; k < data.value.length; k++) {
                          const v = getValue(data, label, k)
                      Severity: Major
                      Found in src/data/cl.data.tools.js and 1 other location - About 3 hrs to fix
                      src/data/cl.data.tools.js on lines 132..140

                      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

                      export function getValueMax (data, label, value) {
                        let out = value
                        if (!Array.isArray(data.value)) return out
                        for (let k = 0; k < data.value.length; k++) {
                          const v = getValue(data, label, k)
                      Severity: Major
                      Found in src/data/cl.data.tools.js and 1 other location - About 3 hrs to fix
                      src/data/cl.data.tools.js on lines 149..157

                      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

                            case 'decvol':
                              if (index === 0) {
                                val = source[fields.vol]
                              } else {
                                val = source[fields.vol] - getValue({
                      Severity: Major
                      Found in src/data/cl.data.tools.js and 1 other location - About 2 hrs to fix
                      src/data/cl.data.tools.js on lines 93..102

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

                      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

                            case 'decmoney':
                              if (index === 0) {
                                val = source[fields.money]
                              } else {
                                val = source[fields.money] - getValue({
                      Severity: Major
                      Found in src/data/cl.data.tools.js and 1 other location - About 2 hrs to fix
                      src/data/cl.data.tools.js on lines 83..92

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

                      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

                        if (!isBegin) {
                          zipday[field.time] = daydata[daydata.length - 1][field.time]
                          out.push(copyArrayOfDeep(zipday))
                        }
                      Severity: Major
                      Found in src/data/cl.data.tools.js and 1 other location - About 1 hr to fix
                      src/data/cl.data.tools.js on lines 741..744

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

                      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

                        if (!isBegin) {
                          zipday[field.time] = daydata[daydata.length - 1][field.time]
                          out.push(copyArrayOfDeep(zipday))
                        }
                      Severity: Major
                      Found in src/data/cl.data.tools.js and 1 other location - About 1 hr to fix
                      src/data/cl.data.tools.js on lines 785..788

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

                      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

                        for (let i = 0; i < source.length; i++) {
                          if (!checkZero(source[i], FIELD_DAY)) {
                            out.push(source[i])
                          }
                        }
                      Severity: Major
                      Found in src/data/cl.data.tools.js and 1 other location - About 1 hr to fix
                      src/util/cl.tool.js on lines 311..315

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

                      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

                          if (k >= daydata.length - 1 || week === 5 ||
                            (getDayGap(daydata[k][field.time], daydata[k + 1][field.time]) + week > 7)) {
                            zipday[field.time] = daydata[k][field.time]
                            out.push(copyArrayOfDeep(zipday))
                            isBegin = true
                      Severity: Minor
                      Found in src/data/cl.data.tools.js and 1 other location - About 55 mins to fix
                      src/data/cl.data.tools.js on lines 779..783

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

                      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

                          if (k >= daydata.length - 1 || getDayMon(daydata[k + 1][field.time]) !== month) {
                            zipday[field.time] = daydata[k][field.time]
                            out.push(copyArrayOfDeep(zipday))
                            isBegin = true
                          }
                      Severity: Minor
                      Found in src/data/cl.data.tools.js and 1 other location - About 55 mins to fix
                      src/data/cl.data.tools.js on lines 734..739

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

                      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