seerline/clchart

View on GitHub

Showing 392 of 392 total issues

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

File cl.seer.js has 406 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/plugins/cl.seer.js - About 5 hrs to fix

    File cl.data.js has 401 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.js - About 5 hrs to fix

      File cl.draw.js has 388 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/util/cl.draw.js - About 5 hrs to fix

        ClChartLine has 38 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export default class ClChartLine {
          /**
        
           * Creates an instance of ClChartLine.
           * @param {Object} father line chart's parent context
        Severity: Minor
        Found in src/chart/cl.chart.line.js - About 5 hrs to fix

          Function onPaint has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

            onPaint () {
              if (this.axisY[this.align].display === 'none') return
              if (this.linkInfo.hideInfo) return
          
              let xx, yy
          Severity: Minor
          Found in src/chart/cl.draw.axisY.js - About 4 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

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

            if (e && Array.isArray(e.touches)) {
              eventObj.touches = []
              for (let i = 0; i < e.touches.length; i++) {
                const point = e.touches[i]
                eventObj.touches.push({
          Severity: Major
          Found in src/event/cl.event.js and 1 other location - About 4 hrs to fix
          src/event/cl.event.js on lines 68..79

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

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

            if (e && Array.isArray(e.changedTouches)) {
              eventObj.changedTouches = []
              for (let i = 0; i < e.changedTouches.length; i++) {
                const point = e.changedTouches[i]
                eventObj.changedTouches.push({
          Severity: Major
          Found in src/event/cl.event.js and 1 other location - About 4 hrs to fix
          src/event/cl.event.js on lines 56..67

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

          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 idx = mmpCount - 1; idx >= 0; idx--) {
                xx = this.rectChart.left + this.layout.title.spaceX
                value = '卖' + strint[idx]
                _drawTxt(this.context, xx, yy, value,
                  this.layout.title.font, this.layout.title.pixel, this.color.txt)
          Severity: Major
          Found in src/plugins/cl.super.js and 1 other location - About 4 hrs to fix
          src/chart/cl.chart.board.js on lines 440..446

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

          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 idx = mmpCount - 1; idx >= 0; idx--) {
                xx = this.rectOrder.left + this.layout.digit.spaceX
                value = '卖' + strint[idx]
                _drawTxt(this.context, xx, yy, value,
                  this.layout.digit.font, this.layout.digit.pixel, this.color.txt)
          Severity: Major
          Found in src/chart/cl.chart.board.js and 1 other location - About 4 hrs to fix
          src/plugins/cl.super.js on lines 293..299

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

          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 cl.chart.board.js has 360 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/chart/cl.chart.board.js - About 4 hrs to fix

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

                    out[checked.index] = [
                      getDate(now.value[now.fields.time]),
                      now.value[now.fields.open],
                      now.value[now.fields.high],
                      now.value[now.fields.low],
            Severity: Major
            Found in src/data/cl.data.js and 1 other location - About 4 hrs to fix
            src/data/cl.data.js on lines 376..384

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

            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 idx = 0; idx < mmpCount; idx++) {
                  xx = this.rectChart.left + this.layout.title.spaceX
                  value = '买' + strint[idx]
                  _drawTxt(this.context, xx, yy, value,
                    this.layout.title.font, this.layout.title.pixel, this.color.txt)
            Severity: Major
            Found in src/plugins/cl.super.js and 1 other location - About 4 hrs to fix
            src/chart/cl.chart.board.js on lines 447..453

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

            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

                    out.push([
                      getDate(now.value[now.fields.time]),
                      now.value[now.fields.open],
                      now.value[now.fields.high],
                      now.value[now.fields.low],
            Severity: Major
            Found in src/data/cl.data.js and 1 other location - About 4 hrs to fix
            src/data/cl.data.js on lines 366..374

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

            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 idx = 0; idx < mmpCount; idx++) {
                  xx = this.rectOrder.left + this.layout.digit.spaceX
                  value = '买' + strint[idx]
                  _drawTxt(this.context, xx, yy, value,
                    this.layout.digit.font, this.layout.digit.pixel, this.color.txt)
            Severity: Major
            Found in src/chart/cl.chart.board.js and 1 other location - About 4 hrs to fix
            src/plugins/cl.super.js on lines 300..306

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

            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 'S':
                      yy += Math.floor((this.maxmin.max - getValue(this.data, 'high', idx)) * this.maxmin.unitY)
                      _drawTxt(this.context, xx - Math.floor(len / 2), yy, '▼', this.symbol.font,
                        this.symbol.pixel, this.color.green, { y: 'bottom' })
                      break
            Severity: Major
            Found in src/chart/cl.draw.trade.js and 1 other location - About 4 hrs to fix
            src/chart/cl.draw.trade.js on lines 68..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 118.

            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 'B':
                      yy += Math.round((this.maxmin.max - getValue(this.data, 'low', idx)) * this.maxmin.unitY)
                      _drawTxt(this.context, xx - Math.floor(len / 2), yy, '▲', this.symbol.font,
                        this.symbol.pixel, this.color.red, { y: 'top' })
                      break
            Severity: Major
            Found in src/chart/cl.draw.trade.js and 1 other location - About 4 hrs to fix
            src/chart/cl.draw.trade.js on lines 74..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 118.

            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 onPaint has 99 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              onPaint () {
                if (!this.config.visible) return
                _setLineWidth(this.context, this.scale)
            
                let clr = this.color.button
            Severity: Major
            Found in src/chart/cl.chart.button.js - About 3 hrs to fix

              Function drawHotSeer has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                drawHotSeer (no) {
                  let idx = findNearTimeToIndex(this.data, getValue(this.sourceSeer, 'start', no), 'time', 'forword')
                  if (idx === -1) idx = this.linkInfo.maxIndex
                  const offset = idx - this.linkInfo.minIndex
                  if (offset < 0) return // 不在视线内就不画
              Severity: Minor
              Found in src/plugins/cl.seer.js - About 3 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

              Severity
              Category
              Status
              Source
              Language