seerline/clchart

View on GitHub

Showing 392 of 392 total issues

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

    _drawHline(this.context, this.rectChart.left, this.rectChart.left + this.rectChart.width, this.rectChart.top + Math.floor(this.rectChart.height / 2))
Severity: Major
Found in src/plugins/cl.super.js and 1 other location - About 1 hr to fix
src/chart/cl.chart.board.js on lines 432..432

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

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

    _drawHline(this.context, this.rectOrder.left, this.rectOrder.left + this.rectOrder.width, this.rectOrder.top + Math.floor(this.rectOrder.height / 2))
Severity: Major
Found in src/chart/cl.chart.board.js and 1 other location - About 1 hr to fix
src/plugins/cl.super.js on lines 285..285

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

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

  getData (key, rightMode) {
    switch (key) {
      case 'DAY':
        this.OutData['DAY'] = {
          key,
Severity: Minor
Found in src/data/cl.data.js - About 1 hr to fix

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

      mergeMDay (source, min) {
        let out = []
    
        if (source !== undefined && !isEmptyArray(source.value)) {
          out = copyArrayOfDeep(source.value)
    Severity: Minor
    Found in src/data/cl.data.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 onPaint has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      onPaint (key) {
        if (key !== undefined) this.hotKey = key
        this.data = this.source.getData(this.hotKey)
        this.codeInfo = this.source.getData('INFO')
    
    
    Severity: Minor
    Found in src/chart/cl.draw.kbar.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 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 touchmove has 47 lines of code (exceeds 25 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 1 hr to fix

      Function mergeNowMinToMin has 47 lines of code (exceeds 25 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 1 hr to fix

        Function beforeLocation has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          beforeLocation () {
            this.linkInfo.rightMode = 'forword'
            this.data = this.source.getData(this.father.hotKey)
            const lastDate = this.data.value[this.data.value.length - 1][this.data.fields.time]
        
        
        Severity: Minor
        Found in src/plugins/cl.seer.js - About 1 hr to fix

          Function findNearTimeToIndex has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          export function findNearTimeToIndex (data, findvalue, label, direction) {
            if (label === undefined) label = 'time'
            if (direction && direction === 'forword') {
              for (let idx = data.value.length - 1; idx >= 0; idx--) {
                if (getValue(data, label, idx) > findvalue) continue
          Severity: Minor
          Found in src/chart/cl.chart.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 onPaint has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            onPaint () {
              this.data = this.father.data
              if (this.axisX.display === 'none') return
          
              let xx, value, spaceX
          Severity: Minor
          Found in src/chart/cl.draw.axisX.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 onMouseMove has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            onMouseMove (event) {
              if (this.linkInfo.hideInfo) return
              if (!this.linkInfo.showCursorLine) return
              // this.draw_clear();
              // 找到X坐标对应的数据索引
          Severity: Minor
          Found in src/chart/cl.chart.line.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 onPaint has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            onPaint () {
              if (!this.config.visible) return
              _setLineWidth(this.context, this.scale)
          
              let clr = this.color.button
          Severity: Minor
          Found in src/chart/cl.chart.button.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 checkBefore has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            checkBefore () {
              if (this.static.before <= 0)
              {   
                console.log(this.InData['NOW'],this.InData['DAY']);
                   
          Severity: Minor
          Found in src/data/cl.data.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 make_command_buffer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          function make_command_buffer(sign, command) {
            // console.log('<===', typeof command, command);
            let cmd = sign + ':{'
            let argv = false
            for (let k = 0; k < command.length; k++) {
          Severity: Minor
          Found in cs/drive.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 drawGridLine has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            drawGridLine () {
              _drawBegin(this.context, this.color.grid)
              _drawRect(this.context, this.rectMain.left, this.rectMain.top, this.rectMain.width, this.rectMain.height)
          
              let mmpCount = 1
          Severity: Minor
          Found in src/chart/cl.chart.board.js - About 1 hr to fix

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

                const xx = this.rectMain.left + offset * (this.linkInfo.unitX + this.linkInfo.spaceX) + Math.floor(this.linkInfo.unitX / 2)
            Severity: Major
            Found in src/plugins/cl.seer.js and 1 other location - About 1 hr to fix
            src/plugins/cl.seer.js on lines 116..116

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

            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: 'ClDrawVLine',
                extremum: { // 如何取极值
                  method: 'normal', // fixedLeft fixedRight 上下固定,此时需要取axisY.middle的定义
                  maxvalue: ['vol'], // 参与计算最大值的标签
            Severity: Major
            Found in src/cl.chart.def.js and 1 other location - About 1 hr to fix
            src/cl.chart.def.js on lines 346..359

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

            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: 'ClDrawVLine',
                extremum: { // 如何取极值
                  method: 'normal', // fixedLeft fixedRight 上下固定,此时需要取axisY.middle的定义
                  maxvalue: ['decvol'], // 参与计算最大值的标签
            Severity: Major
            Found in src/cl.chart.def.js and 1 other location - About 1 hr to fix
            src/cl.chart.def.js on lines 438..451

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

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

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

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

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

            Refactorings

            Further Reading

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

                const xx = this.rectMain.left + offset * (this.linkInfo.unitX + this.linkInfo.spaceX) + Math.floor(this.linkInfo.unitX / 2)
            Severity: Major
            Found in src/plugins/cl.seer.js and 1 other location - About 1 hr to fix
            src/plugins/cl.seer.js on lines 139..139

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

            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