seerline/clchart

View on GitHub

Showing 392 of 392 total issues

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

  if (Arc3 !== undefined && Arc3.r > 0) {
    _drawBegin(context, Arc3.clr)
    _drawCircleAndFilled(context, x, y, Arc3.r, Arc3.clr)
    _drawEnd(context)
  }
Severity: Major
Found in src/util/cl.draw.js and 3 other locations - About 1 hr to fix
src/util/cl.draw.js on lines 513..517
src/util/cl.draw.js on lines 530..534
src/util/cl.draw.js on lines 535..539

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

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

  if (Arc2 !== undefined && Arc2.r > 0) {
    _drawBegin(context, Arc2.clr)
    _drawCircleAndFilled(context, x, y, Arc2.r, Arc2.clr)
    _drawEnd(context)
  }
Severity: Major
Found in src/util/cl.draw.js and 3 other locations - About 1 hr to fix
src/util/cl.draw.js on lines 530..534
src/util/cl.draw.js on lines 535..539
src/util/cl.draw.js on lines 540..544

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

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

      right = formatShowTime(this.data.key, right,
        this.father.dataLayer.tradeTime[this.father.dataLayer.tradeTime.length - 1].end)
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 809..810

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

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

      tail = formatShowTime(this.data.key, tail,
        this.father.dataLayer.tradeTime[this.father.dataLayer.tradeTime.length - 1].end)
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 804..805

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

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

  if (Arc1 !== undefined && Arc1.r > 0) {
    _drawBegin(context, Arc1.clr)
    _drawCircleAndFilled(context, x, y, Arc1.r, Arc1.clr)
    _drawEnd(context)
  }
Severity: Major
Found in src/util/cl.draw.js and 3 other locations - About 1 hr to fix
src/util/cl.draw.js on lines 513..517
src/util/cl.draw.js on lines 535..539
src/util/cl.draw.js on lines 540..544

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

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

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

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

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

Refactorings

Further Reading

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

  if (!isBegin) {
    zipday[field.time] = daydata[daydata.length - 1][field.time]
    out.push(copyArrayOfDeep(zipday))
  }
Severity: Major
Found in src/data/cl.data.tools.js and 1 other location - About 1 hr to fix
src/data/cl.data.tools.js on lines 741..744

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

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

  if (Arc2 !== undefined && Arc2.r > 0) {
    _drawBegin(context, Arc2.clr)
    _drawCircleAndFilled(context, x, y, Arc2.r, Arc2.clr)
    _drawEnd(context)
  }
Severity: Major
Found in src/util/cl.draw.js and 3 other locations - About 1 hr to fix
src/util/cl.draw.js on lines 513..517
src/util/cl.draw.js on lines 530..534
src/util/cl.draw.js on lines 540..544

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

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

  axisY: {
    lines: 3,
    left: {
      display: 'both', // none不显示,all, noupper不显示最上面, nofoot不显示最下面 = 显示坐标
      middle: 'before',
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 425..437

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

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

  axisY: {
    lines: 1,
    left: {
      display: 'nofoot', // none不显示,all, noupper不显示最上面, nofoot不显示最下面 = 显示坐标
      middle: 'none',
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 374..386

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

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

  onPaint (key) {
    if (key !== undefined) this.hotKey = key
    this.data = this.source.getData(this.hotKey)

    if (this.info.labelX === undefined) this.info.labelX = 'time'
Severity: Minor
Found in src/chart/cl.draw.vline.js - About 1 hr to fix

    Function checkLayout has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function checkLayout (layout) {
      const scale = _systemInfo.scale
      layout.margin.top *= scale
      layout.margin.left *= scale
      layout.margin.bottom *= scale
    Severity: Minor
    Found in src/chart/cl.chart.init.js - About 1 hr to fix

      Function matchDayToMon has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function matchDayToMon (daydata) {
        let month
        const out = []
        const zipday = []
      
      
      Severity: Minor
      Found in src/data/cl.data.tools.js - About 1 hr to fix

        Function matchDayToWeek has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function matchDayToWeek (daydata) {
          const out = []
          const zipday = []
        
          const field = FIELD_DAY
        Severity: Minor
        Found in src/data/cl.data.tools.js - About 1 hr to fix

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

            drawReports () {
              if (this.reportData === undefined || this.reportData.value.length < 1) return
              const maxlines = Math.floor(this.rectReport.height / this.layout.digit.height) - 1 // 屏幕最大能显示多少条记录
              const recs = this.reportData.value.length
              const beginIndex = recs > maxlines ? recs - maxlines : 0
          Severity: Minor
          Found in src/chart/cl.chart.report.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 formatVolume has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          export function formatVolume (value, volzoom) {
            if (value === undefined || isNaN(value)) return '--'
            if (typeof value === 'string') value = parseFloat(value)
          
            if (volzoom === undefined) volzoom = 1
          Severity: Minor
          Found in src/util/cl.tool.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 getMoveData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            getMoveData (index) {
              let lines = this.config.lines
              const out = []
              if (!Array.isArray(lines)) return out
          
          
          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 drawTick has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            drawTick () {
              if (this.tickData === undefined || this.tickData.value.length < 1) return
              const maxlines = Math.floor(this.rectTick.height / this.layout.digit.height) - 1 // 屏幕最大能显示多少条记录
              const recs = this.tickData.value.length
              const beginIndex = recs > maxlines ? recs - maxlines : 0
          Severity: Minor
          Found in src/chart/cl.chart.board.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 flushMin has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            flushMin (nowdata, fields) {
              if (this.InData['MIN'] === undefined) {
                this.InData['MIN'] = {
                  key: 'MIN',
                  fields: FIELD_MIN,
          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 drawOrder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            drawOrder () 
            {
              if (this.tickData === undefined || this.tickData.value.length < 1) return
              const maxlines = Math.floor(this.rectTick.height / this.layout.digit.height) - 1 // 屏幕最大能显示多少条记录
              const recs = this.tickData.value.length
          Severity: Minor
          Found in src/plugins/cl.super.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 formatInfo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          export function formatInfo (value, format, coindot, volzoom, middle) {
            let out
            if (format === 'rate') {
              out = formatRate(value, middle)
            } else {
          Severity: Minor
          Found in src/util/cl.tool.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

          Severity
          Category
          Status
          Source
          Language