seerline/clchart

View on GitHub

Showing 392 of 392 total issues

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

      if (this.config.txt.right !== undefined && this.rectMid.width > 2 * len) {
        _drawTxt(this.context, this.rectMid.left + this.rectMid.width - this.scale,
          this.rectMid.top + spaceY, this.config.txt.right,
          this.layout.scroll.font, this.layout.scroll.pixel, this.color.axis, { x: 'end' })
      }
Severity: Major
Found in src/chart/cl.chart.scroll.js and 1 other location - About 3 hrs to fix
src/chart/cl.chart.scroll.js on lines 310..314

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

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

  lines: [{
    className: 'ClDrawLine',
    extremum: { // 如何取极值
      method: 'fixedLeft', // fixedLeft fixedRight 上下固定,此时需要取axisY.middle的定义
      maxvalue: ['high'], // 参与计算最大值的标签
Severity: Major
Found in src/cl.chart.def.js and 1 other location - About 3 hrs to fix
src/cl.chart.def.js on lines 387..409

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

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.tail !== undefined) {
        _drawTxt(this.context, this.rectChart.left + this.rectChart.width - this.scale,
          this.rectChart.top + spaceY, this.config.txt.tail,
          this.layout.scroll.font, this.layout.scroll.pixel, this.color.axis, { x: 'end' })
      }
Severity: Major
Found in src/chart/cl.chart.scroll.js and 1 other location - About 3 hrs to fix
src/chart/cl.chart.scroll.js on lines 335..339

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

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

  lines: [{
    className: 'ClDrawLine',
    extremum: { // 如何取极值
      method: 'fixedLeft', // fixedLeft fixedRight 上下固定,此时需要取axisY.middle的定义
      maxvalue: ['close'], // 参与计算最大值的标签
Severity: Major
Found in src/cl.chart.def.js and 1 other location - About 3 hrs to fix
src/cl.chart.def.js on lines 295..317

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

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.tool.js has 317 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.tool.js - About 3 hrs to fix

    Function updateJsonOfDeep has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    export function updateJsonOfDeep (obj, source) {
      let out
      if (source instanceof Object) {
        if (Array.isArray(source)) {
          out = []
    Severity: Minor
    Found in src/util/cl.tool.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

    Function touchmove has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      touchmove (e) {
        const event = this.eventBuild(e)
        if (new Date() - this.__timestamp < 150) {
          return event
        }
    Severity: Minor
    Found in src/event/cl.event.handler.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

    Function onPaint has a Cognitive Complexity of 24 (exceeds 5 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: 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

    Function setPublicRect has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      setPublicRect () { // 计算所有矩形区域
        // rectChart 画图区
        // rectTitle rectMess
        // rectAxisX
        // rectScroll
    Severity: Major
    Found in src/chart/cl.chart.line.js - About 3 hrs to fix

      Function calcMaxMin has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        calcMaxMin (data, extremum, start, stop) {
          const mm = {
            max: 0.0,
            min: 0.0
          }
      Severity: Major
      Found in src/chart/cl.chart.line.js - About 3 hrs to fix

        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

        Function onMouseMove has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          onMouseMove (event) {
            if (!this.mouseDown) return
            const mousePos = event.mousePos
            if (inRect(this.rectMin, mousePos) || inRect(this.rectMax, mousePos)) {
              changeCursorStyle('col-resize')
        Severity: Minor
        Found in src/chart/cl.chart.scroll.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

        Function mergeNowMinToMin has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          mergeNowMinToMin (source, min, offset) {
            const curMin = []
            let sumVol = 0
            let sumMoney = 0
        
        
        Severity: Minor
        Found in src/data/cl.data.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

        Function onPaint has 81 lines of code (exceeds 25 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: Major
        Found in src/chart/cl.draw.cursor.js - About 3 hrs to fix

          Function setButtons has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            setButtons () {
              let chart
              let xx, yy
              let ww = 25 * this.scale
              if (this.hasButton('zoomin', this.buttons) || this.hasButton('zoomout', this.buttons)) {
          Severity: Major
          Found in src/chart/cl.chart.line.js - About 3 hrs to fix

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

                  default:
                    _drawTxt(this.context, this.rectMain.left + center.xx, this.rectMain.top + center.yy, info.map,
                      this.layout.title.font, this.layout.title.pixel, this.color.button, {
                        x: 'center',
                        y: 'middle'
            Severity: Major
            Found in src/chart/cl.chart.button.js and 1 other location - About 3 hrs to fix
            src/chart/cl.chart.button.js on lines 191..197

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

            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 '9':
                    _drawTxt(this.context, this.rectMain.left + center.xx, this.rectMain.top + center.yy, info.map,
                      this.layout.title.font, this.layout.title.pixel, this.color.baktxt, {
                        x: 'center',
                        y: 'middle'
            Severity: Major
            Found in src/chart/cl.chart.button.js and 1 other location - About 3 hrs to fix
            src/chart/cl.chart.button.js on lines 208..214

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

            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 const COLOR_WHITE = {
              sys: 'white',
              line: ['#4048cc', '#dd8d2d', '#168ee0', '#ad7eac', '#ff8290', '#ba1215'],
              back: '#fafafa',
              txt: '#2f2f2f',
            Severity: Major
            Found in src/chart/cl.chart.init.js and 1 other location - About 3 hrs to fix
            src/chart/cl.chart.init.js on lines 47..64

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

            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 const COLOR_BLACK = {
              sys: 'black',
              line: ['#efefef', '#fdc104', '#5bbccf', '#ad7eac', '#bf2f2f', '#cfcfcf'],
              back: '#232323',
              txt: '#bfbfbf',
            Severity: Major
            Found in src/chart/cl.chart.init.js and 1 other location - About 3 hrs to fix
            src/chart/cl.chart.init.js on lines 26..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 98.

            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