jiskattema/spot

View on GitHub

Showing 2,641 of 2,641 total issues

Function initChart has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function initChart (view) {
  // Configure plot
  view._config = view.model.chartjsConfig();
  var options = view._config.options;

Severity: Minor
Found in src/widgets/views/chartjs2d.js - About 2 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

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

    'change [data-hook~=group-endduration-input]': function () {
      var d = moment.duration(this.queryByHook('group-endduration-input').value);
      if (moment.isDuration(d)) {
        this.model.maxval = d;
      }
Severity: Major
Found in src/pages/configure-partition/partition-duration.js and 1 other location - About 2 hrs to fix
src/pages/configure-partition/partition-duration.js on lines 54..60

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

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

    'change [data-hook~=group-startduration-input]': function () {
      var d = moment.duration(this.queryByHook('group-startduration-input').value);
      if (moment.isDuration(d)) {
        this.model.minval = d;
      }
Severity: Major
Found in src/pages/configure-partition/partition-duration.js and 1 other location - About 2 hrs to fix
src/pages/configure-partition/partition-duration.js on lines 61..67

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

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

  importJSON: function () {
    // var fileLoader = this.queryByHook('json-upload-input');
    var fileLoader = document.getElementById('jsonuploadBtn');
    var uploadedFile = fileLoader.files[0];
    var reader = new window.FileReader();
Severity: Major
Found in src/app.js - About 2 hrs to fix

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

        allSessions.forEach(function(sess, index) {
          console.log("[" + index + "]: " + sess.id + '  ', sess.name);
          if ( input_session.id === sess.id )
            allSessions.splice(index, 1);
        });
    Severity: Major
    Found in src/app.js and 1 other location - About 2 hrs to fix
    src/app.js on lines 343..347

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

    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

        allDatasets.forEach(function(dset, index) {
          console.log("[" + index + "]: " + dset.id + '  ', dset.name);
          if ( dataset.id === dset.id )
            allDatasets.splice(index, 1);
        });
    Severity: Major
    Found in src/app.js and 1 other location - About 2 hrs to fix
    src/app.js on lines 385..389

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

    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

        dataMin = filter.data.reduce(function (prev, curr) {
          if (prev.aa === misval || curr.aa === misval) {
            return curr;
          }
          return prev.aa < curr.aa ? prev : curr;
    Severity: Major
    Found in src/widgets/views/scatter.js and 1 other location - About 2 hrs to fix
    src/widgets/views/scatter.js on lines 120..125

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

    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

        dataMax = filter.data.reduce(function (prev, curr) {
          if (prev.aa === misval || curr.aa === misval) {
            return curr;
          }
          return prev.aa < curr.aa ? curr : prev;
    Severity: Major
    Found in src/widgets/views/scatter.js and 1 other location - About 2 hrs to fix
    src/widgets/views/scatter.js on lines 113..118

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

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

    module.exports = function (Chart, chartType, newType) {
      var helpers = Chart.helpers;
    
      // ErrorBar element
      Chart.elements.ErrorBar = Chart.elements.ErrorBar || Chart.Element.extend({
    Severity: Minor
    Found in src/widgets/chartjs-errorbars.js - About 2 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 chartjsConfig has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      chartjsConfig: function () {
        return {
          type: 'bubbleError',
          data: {
            datasets: []
    Severity: Major
    Found in src/widgets/models/bubbleplot.js - About 2 hrs to fix

      File chartjs2d.js has 258 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var app = require('ampersand-app');
      var Spot = require('spot-framework');
      var BaseWidget = require('./base-widget');
      var Chart = require('chart.js');
      var colors = require('../../colors');
      Severity: Minor
      Found in src/widgets/views/chartjs2d.js - About 2 hrs to fix

        exports has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        module.exports = PageView.extend({
          template: templates.datasets.page,
          initialize: function () {
            this.pageName = 'datasets';
            this.helpTemplate = '';
        Severity: Minor
        Found in src/pages/datasets.js - About 2 hrs to fix

          Function chartjsConfig has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            chartjsConfig: function () {
              return {
                type: 'lineError',
                data: {
                  datasets: [],
          Severity: Major
          Found in src/widgets/models/linechart.js - About 2 hrs to fix

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

                'change [data-hook~=group-enddate-input]': function () {
                  var d = moment(this.queryByHook('group-enddate-input').value);
                  if (d.isValid()) {
                    this.model.maxval = d;
                  }
            Severity: Major
            Found in src/pages/configure-partition/partition-datetime.js and 1 other location - About 2 hrs to fix
            src/pages/configure-partition/partition-datetime.js on lines 59..65

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

            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

                'change [data-hook~=group-startdate-input]': function () {
                  var d = moment(this.queryByHook('group-startdate-input').value);
                  if (d.isValid()) {
                    this.model.minval = d;
                  }
            Severity: Major
            Found in src/pages/configure-partition/partition-datetime.js and 1 other location - About 2 hrs to fix
            src/pages/configure-partition/partition-datetime.js on lines 66..72

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

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

            module.exports = BaseWidget.extend({
              template: '<div class="widgetInner mdl-card__media"></div>',
            
              update: function () {
                update(this);
            Severity: Major
            Found in src/widgets/views/chartjs2d.js and 4 other locations - About 2 hrs to fix
            src/widgets/views/chartjs.js on lines 234..248
            src/widgets/views/chartjs1d.js on lines 230..244
            src/widgets/views/scatter.js on lines 192..206
            src/widgets/views/sigma.js on lines 149..163

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

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

            module.exports = BaseWidget.extend({
              template: '<div class="widgetInner mdl-card__media"></div>',
            
              update: function () {
                update(this);
            Severity: Major
            Found in src/widgets/views/scatter.js and 4 other locations - About 2 hrs to fix
            src/widgets/views/chartjs.js on lines 234..248
            src/widgets/views/chartjs1d.js on lines 230..244
            src/widgets/views/chartjs2d.js on lines 322..336
            src/widgets/views/sigma.js on lines 149..163

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

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

            module.exports = BaseWidget.extend({
              template: '<div class="widgetInner sigmajs mdl-card__media"></div>',
            
              update: function () {
                update(this);
            Severity: Major
            Found in src/widgets/views/sigma.js and 4 other locations - About 2 hrs to fix
            src/widgets/views/chartjs.js on lines 234..248
            src/widgets/views/chartjs1d.js on lines 230..244
            src/widgets/views/chartjs2d.js on lines 322..336
            src/widgets/views/scatter.js on lines 192..206

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

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

            module.exports = BaseWidget.extend({
              template: '<div class="widgetInner mdl-card__media"></div>',
            
              update: function () {
                update(this);
            Severity: Major
            Found in src/widgets/views/chartjs1d.js and 4 other locations - About 2 hrs to fix
            src/widgets/views/chartjs.js on lines 234..248
            src/widgets/views/chartjs2d.js on lines 322..336
            src/widgets/views/scatter.js on lines 192..206
            src/widgets/views/sigma.js on lines 149..163

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

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

            module.exports = BaseWidget.extend({
              template: '<div class="widgetInner mdl-card__media"></div>',
            
              update: function () {
                update(this);
            Severity: Major
            Found in src/widgets/views/chartjs.js and 4 other locations - About 2 hrs to fix
            src/widgets/views/chartjs1d.js on lines 230..244
            src/widgets/views/chartjs2d.js on lines 322..336
            src/widgets/views/scatter.js on lines 192..206
            src/widgets/views/sigma.js on lines 149..163

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

            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