seerline/clchart

View on GitHub

Showing 392 of 392 total issues

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

  touchend (e) {
    const event = this.eventBuild(e)
    clearTimeout(this.longTapTimeout)
    const point = event.changedTouches ? event.changedTouches[0] : event
    const timestamp = Date.now()
Severity: Minor
Found in src/event/cl.event.handler.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 emitEvent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  emitEvent (eventName, config) {
    const event = copyJsonOfDeep(config)
    const mousePos = this.getMousePos(config)
    // 这里生成一个相对鼠标位置
    event.mousePos = {
Severity: Minor
Found in src/event/cl.event.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 beforeLocation has a Cognitive Complexity of 11 (exceeds 5 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

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

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

export function checkMDay (source, tradeDate, tradetime) {
  const out = []
  if (source.length < 1) return out

  const lastDate = getDate(source[source.length - 1][FIELD_MDAY.time])
Severity: Minor
Found in src/data/cl.data.tools.js - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  for (let bi = 0; bi < b.length; bi++) {
    if (!inArray(b[bi], result)) {
      result.push(b[bi])
    }
  }
Severity: Major
Found in src/util/cl.tool.js and 1 other location - About 1 hr to fix
src/data/cl.data.tools.js on lines 479..483

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

Function formatShowTime has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function formatShowTime (key, value, minute) {
  let out = value
  switch (key) {
    case 'M5':
    case 'M15':
Severity: Minor
Found in src/util/cl.tool.js - About 1 hr to fix

    Function onPaint has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      onPaint (key) {
        if (key !== undefined) this.hotKey = key
        this.data = this.source.getData(this.hotKey)
    
        const len = _getTxtWidth(this.context, '▲', this.symbol.font, this.symbol.pixel)
    Severity: Minor
    Found in src/chart/cl.draw.trade.js - About 1 hr to fix

      Function _setTransColor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function _setTransColor (scolor, trans, style) {
        const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
        let sColor = scolor.toLowerCase()
        if (sColor && reg.test(sColor)) {
          if (sColor.length === 4) {
      Severity: Minor
      Found in src/util/cl.draw.js - About 1 hr to fix

        Function mergeDay has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          mergeDay (source, now, rightMode) {
            let out = copyArrayOfDeep(source.value)
            if (now !== undefined && !checkZero(now.value, now.fields)) {
              const checked = findDateInDay(source, getDate(now.value[now.fields.time]))
              if (checked.finded) {
        Severity: Minor
        Found in src/data/cl.data.js - About 1 hr to fix

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

              if (this.config.axisY.right.display !== 'none') {
                draw = new ClDrawAxisY(this, this.rectAxisYRight, 'right')
                this.childDraws['AXISY_RIGHT'] = draw
              }
          Severity: Major
          Found in src/chart/cl.chart.line.js and 1 other location - About 1 hr to fix
          src/chart/cl.chart.line.js on lines 313..316

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

          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 3 locations. Consider refactoring.
          Open

            constructor (father) {
              initCommonInfo(this, father)
              this.linkInfo = father.linkInfo
              this.static = this.father.dataLayer.static
            }
          Severity: Major
          Found in src/plugins/cl.super.js and 2 other locations - About 1 hr to fix
          src/chart/cl.chart.board.js on lines 56..60
          src/chart/cl.chart.report.js on lines 49..53

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

          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 3 locations. Consider refactoring.
          Open

            constructor (father) {
              initCommonInfo(this, father)
              this.linkInfo = father.linkInfo
              this.static = this.father.dataLayer.static
            }
          Severity: Major
          Found in src/chart/cl.chart.board.js and 2 other locations - About 1 hr to fix
          src/chart/cl.chart.report.js on lines 49..53
          src/plugins/cl.super.js on lines 51..55

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

          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 offx = (this.rectChart.width - xpos - 2 * this.layout.digit.spaceX - this.closeLen - this.volLen) / 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 297..297

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

          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 offx = (this.rectOrder.width - xpos - 2 * this.layout.digit.spaceX - this.closeLen - this.volLen) / 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 154..154

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

          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 3 locations. Consider refactoring.
          Open

            constructor (father) {
              initCommonInfo(this, father)
              this.linkInfo = father.linkInfo
              this.static = this.father.dataLayer.static
            }
          Severity: Major
          Found in src/chart/cl.chart.report.js and 2 other locations - About 1 hr to fix
          src/chart/cl.chart.board.js on lines 56..60
          src/plugins/cl.super.js on lines 51..55

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

          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.axisY.left.display !== 'none') {
                draw = new ClDrawAxisY(this, this.rectAxisYLeft, 'left')
                this.childDraws['AXISY_LEFT'] = draw
              }
          Severity: Major
          Found in src/chart/cl.chart.line.js and 1 other location - About 1 hr to fix
          src/chart/cl.chart.line.js on lines 317..320

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

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

            locationData () {
              if (this.data === undefined) return
              const size = getSize(this.data)
              if (this.config.axisX.type === 'day1') {
                setFixedLineFlags(
          Severity: Minor
          Found in src/chart/cl.chart.line.js - About 1 hr to fix

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

                  if (config.left && xx < config.left + tr.width / 2) {
                    xx = config.left + tr.width / 2
                  }
            Severity: Major
            Found in src/util/cl.draw.js and 2 other locations - About 1 hr to fix
            src/util/cl.draw.js on lines 577..579
            src/util/cl.draw.js on lines 580..582

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

            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 3 locations. Consider refactoring.
            Open

                  if (config.top && yy < config.top + tr.height / 2) {
                    yy = config.top + tr.height / 2
                  }
            Severity: Major
            Found in src/util/cl.draw.js and 2 other locations - About 1 hr to fix
            src/util/cl.draw.js on lines 580..582
            src/util/cl.draw.js on lines 627..629

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

            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