creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

Function _renderAnnotations has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

DygraphCanvasRenderer.prototype._renderAnnotations = function() {
    var annotationStyle = {
        "position": "absolute",
        "fontSize": this.attr_('axisLabelFontSize') + "px",
        "zIndex": 10,
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 4 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

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

export default (cb) => {
  let options = packageJson.jest;

  if (CLIOptions.hasFlag('watch')) {
    Object.assign(options, { watchAll: true});
Severity: Major
Found in aurelia_project/tasks/test.js and 1 other location - About 4 hrs to fix
src_aurelia-bodylight-plugin/aurelia_project/tasks/test.js on lines 7..21

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

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

export default (cb) => {
  let options = packageJson.jest;

  if (CLIOptions.hasFlag('watch')) {
    Object.assign(options, { watchAll: true});
Severity: Major
Found in src_aurelia-bodylight-plugin/aurelia_project/tasks/test.js and 1 other location - About 4 hrs to fix
aurelia_project/tasks/test.js on lines 7..21

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

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

Dygraph.prototype.rollingAverage = function(originalData, rollPeriod) {
    if (originalData.length < 2)
        return originalData;
    rollPeriod = Math.min(rollPeriod, originalData.length);
    var rollingData = [];
Severity: Major
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 4 hrs to fix

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

        if (this.tohash) {
          if (this.previousvalue != this.value) {  //change only if it differs from previous value
            this.previousvalue = this.value;
            if (this.value.length>0 && this.value[0] === '#') window.location.hash = this.value;
            else window.location.hash = '#'+this.value; //add hash if it is missing in the string value
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/elements/value.js and 1 other location - About 4 hrs to fix
    src_aurelia-bodylight-plugin/src/elements/fb-get-state.js on lines 18..24

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

    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 (this.tohash) {
                    if (this.previousvalue != this.value) {  //change only if it differs from previous value
                      this.previousvalue = this.value;
                      if (this.value.length>0 && this.value[0] === '#') window.location.hash = this.value;
                      else window.location.hash = '#'+this.value; //add hash if it is missing in the string value
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/elements/fb-get-state.js and 1 other location - About 4 hrs to fix
    src_aurelia-bodylight-plugin/src/elements/value.js on lines 135..141

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

    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 extremeValues_ has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.prototype.extremeValues_ = function(series) {
        var minY = null, maxY = null, j, y;
    
        var bars = this.attr_("errorBars") || this.attr_("customBars");
        if (bars) {
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 4 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 attached has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

      attached() {
        //listening to custom event fmidata
        console.log('dygraph attached');
        if (this.refindex && (this.refindex.indexOf(',')>0)) this.refindices = this.refindex.split(',');
        let fmielement = document.getElementById(this.fromid);
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/dygraphchart.js - About 4 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 bind has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

      bind() {
        //register throttled update function    
        if (typeof this.throttle === 'string') this.throttle = parseInt(this.throttle, 10);
        if (typeof this.tofixed === 'string') this.tofixed = parseInt(this.tofixed, 10);
        if (typeof this.dataevent === 'string') this.dataevent = this.dataevent === 'true';
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/value.js - About 4 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 parseDataTable_ has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Dygraph.prototype.parseDataTable_ = function(data) {
        var shortTextForAnnotationNum = function(num) {
            // converts [0-9]+ [A-Z][a-z]*
            // example: 0=A, 1=B, 25=Z, 26=Aa, 27=Ab
            // and continues like.. Ba Bb .. Za .. Zz..Aaa...Zzz Aaaa Zzzz
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 4 hrs to fix

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

                                      if (isNaN(value)) {
                                          //value is object x, y
                                          ctx.moveTo(0, y);
                                          ctx.lineTo(x, y);
                                          ctx.lineTo(x, chart.height);
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/elements/chartjs-time.js and 1 other location - About 4 hrs to fix
      src_aurelia-bodylight-plugin/src/elements/chartjs-fixed.js on lines 149..169

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

      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 (isNaN(value)) {
                                          //value is object x, y
                                          ctx.moveTo(0, y);
                                          ctx.lineTo(x, y);
                                          ctx.lineTo(x, chart.height);
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/elements/chartjs-fixed.js and 1 other location - About 4 hrs to fix
      src_aurelia-bodylight-plugin/src/elements/chartjs-time.js on lines 143..165

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

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

      Dygraph.prototype.parseCSV_ = function(data) {
          var ret = [];
          var lines = data.split("\n");
          var vals, j;
      
      
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 4 hrs to fix

        Function doUnzoom_ has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

        Dygraph.prototype.doUnzoom_ = function() {
            var dirty = false, dirtyX = false, dirtyY = false;
            if (this.dateWindow_ !== null) {
                dirty = true;
                dirtyX = true;
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 4 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 _evaluateLimits has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

        DygraphLayout.prototype._evaluateLimits = function () {
            //TODO(tomaton): fix xrange when last x value is not the highest in case of x = sin(y) x is from 0 to 1 and back to 0
            //and range for x is 0 to 1
            this.minxval = this.maxxval = null;
            if (this.dateWindow_) {
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 4 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 constructor has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

          constructor() {
            this.handleValueChange = e => {
              //sets data to dataset
              //apply value convert among all data
              let rawdata;
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/elements/chartjs.js - About 4 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 constructor has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            constructor() {
                super();
                this.handleXData  = e => {
                    window.refpoint = e.target.value;
                    this.updatechart();
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/elements/chartjs-time.js - About 4 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

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

                    if (index == -1) {
                        let question = '';
                        let qelement = document.getElementById(qid);
                        if (qelement) question = qelement.getAttribute('question');
                        console.log('adding default '+qid+' question '+question);
        Severity: Major
        Found in src_aurelia-bodylight-plugin/src/elements/quiz-summary.js and 1 other location - About 4 hrs to fix
        src_aurelia-bodylight-plugin/src/elements/quiz-summary.js on lines 80..87

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

        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

        Dygraph.pageY = function(e) {
            if (e.pageY) {
                return (!e.pageY || e.pageY < 0) ? 0 : e.pageY;
            } else {
                var de = document;
        Severity: Major
        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js and 1 other location - About 4 hrs to fix
        src_aurelia-bodylight-plugin/src/utils/dygraph.js on lines 5493..5503

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

        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

        Dygraph.pageX = function(e) {
            if (e.pageX) {
                return (!e.pageX || e.pageX < 0) ? 0 : e.pageX;
            } else {
                var de = document;
        Severity: Major
        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js and 1 other location - About 4 hrs to fix
        src_aurelia-bodylight-plugin/src/utils/dygraph.js on lines 5511..5521

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

        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