seerline/clchart

View on GitHub

Showing 392 of 392 total issues

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

  onPaint (mousePos, valueX, valueY) {
    if (typeof this.context._beforePaint === 'function') {
      this.context._beforePaint()
    }
    if (inRangeX(this.rectChart, mousePos.x) === false) return
Severity: Minor
Found in src/chart/cl.draw.cursor.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

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

        if (this.InData['MIN'] && this.InData['MIN'].value && this.InData['MIN'].value.length > 0)
        {
          this.static.before = this.InData['MIN'].value[0][FIELD_DAY.open]
        }
Severity: Major
Found in src/data/cl.data.js and 1 other location - About 2 hrs to fix
src/data/cl.data.js on lines 133..136

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

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 (this.InData['MDAY'] && this.InData['MDAY'].value && this.InData['MDAY'].value.length > 0)
        {
          this.static.before = this.InData['MDAY'].value[0][FIELD_TICK.close]
        }
Severity: Major
Found in src/data/cl.data.js and 1 other location - About 2 hrs to fix
src/data/cl.data.js on lines 129..132

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

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

  onPaint () {
    if (this.axisY[this.align].display === 'none') return
    if (this.linkInfo.hideInfo) return

    let xx, yy
Severity: Major
Found in src/chart/cl.draw.axisY.js - About 2 hrs to fix

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

          if (this.config.txt.head !== undefined) {
            _drawTxt(this.context, this.rectChart.left + this.scale, this.rectChart.top + spaceY,
              this.config.txt.head,
              this.layout.scroll.font, this.layout.scroll.pixel, this.color.axis)
          }
    Severity: Major
    Found in src/chart/cl.chart.scroll.js and 1 other location - About 2 hrs to fix
    src/chart/cl.chart.scroll.js on lines 330..334

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

    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 (this.config.txt.left !== undefined && this.rectMid.width > len) {
            _drawTxt(this.context, this.rectMid.left + this.scale, this.rectMid.top + spaceY,
              this.config.txt.left,
              this.layout.scroll.font, this.layout.scroll.pixel, this.color.axis)
          }
    Severity: Major
    Found in src/chart/cl.chart.scroll.js and 1 other location - About 2 hrs to fix
    src/chart/cl.chart.scroll.js on lines 305..309

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

    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

            _drawTxtRect(this.context, xx, yy, txt, {
              font: this.axisX.font,
              pixel: this.axisX.pixel,
              spaceX: this.axisX.spaceX,
              clr: this.color.txt,
    Severity: Major
    Found in src/chart/cl.draw.cursor.js and 1 other location - About 2 hrs to fix
    src/chart/cl.draw.cursor.js on lines 124..132

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

    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

            _drawTxtRect(this.context, xx, yy, txt, {
              font: this.axisX.font,
              pixel: this.axisX.pixel,
              spaceX: this.axisX.spaceX,
              clr: this.color.txt,
    Severity: Major
    Found in src/chart/cl.draw.cursor.js and 1 other location - About 2 hrs to fix
    src/chart/cl.draw.cursor.js on lines 105..113

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

    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.init.js has 282 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.init.js - About 2 hrs to fix

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

      export function _drawSignHLine (context, config, item) {
        _drawBegin(context, config.clr)
        _drawDashLine(context, config.xx, config.yy, config.right - config.pixel / 2, config.yy, 7)
        _drawEnd(context)
      
      
      Severity: Minor
      Found in src/util/cl.draw.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 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

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

              if (this.InData['MIN'].value[checked.index][fields.high] < nowdata[fields.close]) {
                this.InData['MIN'].value[checked.index][fields.high] = nowdata[fields.close]
              }
      Severity: Major
      Found in src/data/cl.data.js and 1 other location - About 2 hrs to fix
      src/data/cl.data.js on lines 232..234

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

      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 (this.InData['MIN'].value[checked.index][fields.low] > nowdata[fields.close]) {
                this.InData['MIN'].value[checked.index][fields.low] = nowdata[fields.close]
              }
      Severity: Major
      Found in src/data/cl.data.js and 1 other location - About 2 hrs to fix
      src/data/cl.data.js on lines 229..231

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

      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

              } else if (inArray(status, [101, 201])) {
                color = this.color.red
                price = getValue(this.sourceSeer, 'target', no)
                yl = this.rectMain.top + Math.round((this.maxmin.max - price) * this.maxmin.unitY)
              } else if (inArray(status, [300])) {
      Severity: Major
      Found in src/plugins/cl.seer.js and 1 other location - About 2 hrs to fix
      src/plugins/cl.seer.js on lines 325..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 87.

      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 (inArray(status, [102, 202])) {
                color = this.color.green
                price = getValue(this.sourceSeer, 'stoploss', no)
                yl = this.rectMain.top + Math.round((this.maxmin.max - price) * this.maxmin.unitY)
              } else if (inArray(status, [101, 201])) {
      Severity: Major
      Found in src/plugins/cl.seer.js and 1 other location - About 2 hrs to fix
      src/plugins/cl.seer.js on lines 329..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 87.

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

        onPaint (key) {
          // if (key !== undefined) this.hotKey = key
          // this.data = this.source.getData(this.hotKey)
          // 设置可见
          for (const k in this.showSeer) {
      Severity: Major
      Found in src/plugins/cl.seer.js - About 2 hrs to fix

        Function readyDraw has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          readyDraw () { // 计算最大最小值等
            // 画滚动块
            this.readyScroll()
        
            // 求最大最小值
        Severity: Minor
        Found in src/chart/cl.chart.line.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 checkHotWin has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          checkHotWin (event, charts) {
            for (let k = 0; k < charts.length; k++) {
              let finded = false
              for (let i = 0; i < this.hotWin.length; i++) {
                if (!inRect(this.hotWin[i].rectMain, event.mousePos)) {
        Severity: Minor
        Found in src/event/cl.event.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

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

          onClick (/* e */) {
            if (this.isIndex) return // 如果是指数就啥也不干
            if (this.style === 'normal') {
              this.style = 'tiny'
            } else {
        Severity: Major
        Found in src/chart/cl.chart.board.js and 1 other location - About 2 hrs to fix
        src/chart/cl.chart.report.js on lines 93..101

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

        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