jiskattema/spot

View on GitHub

Showing 2,641 of 2,641 total issues

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

function deinitChart (view) {
  if (view._chartjs) {
    view._chartjs.destroy();
    delete view._chartjs;
  }
Severity: Major
Found in src/widgets/views/chartjs.js and 2 other locations - About 3 hrs to fix
src/widgets/views/chartjs1d.js on lines 21..33
src/widgets/views/chartjs2d.js on lines 50..62

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

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

function resizeChartjsData (chartData, partitionA, partitionB, options) {
  var x = partitionA ? partitionA.groups.length : 1;
  var y = partitionB ? partitionB.groups.length : 1;

  options = options || {};
Severity: Major
Found in src/widgets/views/util.js - About 3 hrs to fix

    Function update has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function update (view) {
      if (!view.isInitialized) {
        return;
      }
    
    
    Severity: Major
    Found in src/widgets/views/scatter.js - About 3 hrs to fix

      Function update has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function update (view) {
        if (!view.isInitialized) {
          console.warn('Cannot update chart, not initialized', view);
          return;
        }
      Severity: Major
      Found in src/widgets/views/chartjs.js - About 3 hrs to fix

        Function initializeCharts has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        function initializeCharts (view) {
          var gridster = view._widgetsGridster;
        
          // BUGFIX: can sometimes get called before gridster is fully initialized
          if (!gridster) {
        Severity: Minor
        Found in src/pages/analyze.js - About 3 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

        File chartjs-duration-scale.js has 293 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* global window: false */
        'use strict';
        var moment = require('moment-timezone');
        
        function prettyPrintDuration (tick) {
        Severity: Minor
        Found in src/widgets/chartjs-duration-scale.js - About 3 hrs to fix

          `` has 25 functions (exceeds 20 allowed). Consider refactoring.
          Open

          app.extend({
            /**
             * [fullscreenMode description]
             * @type {Boolean}
             */
          Severity: Minor
          Found in src/app.js - About 2 hrs to fix

            Function initChart has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function initChart (view) {
              // Configure plot
              view._config = view.model.chartjsConfig();
              var options = view._config.options;
            
            
            Severity: Major
            Found in src/widgets/views/chartjs2d.js - About 2 hrs to fix

              Function importCSV has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function updateBubbles has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                function updateBubbles (view) {
                  var filter = view.model.filter;
                  var chartData = view._config.data;
                
                  var partitionA = filter.partitions.get(1, 'rank');
                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

                  addSessionToLocalStorage: function(session) {
                    console.log('Adding a session to the local storage');
                    console.log(session);
                    var allSessions = this.getSessionsFromLocalStorage();
                    // allDatasets.forEach(function(dset, index) {
                Severity: Major
                Found in src/app.js and 1 other location - About 2 hrs to fix
                src/app.js on lines 325..334

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

                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

                  addDatasetToLocalStorage: function(dataset) {
                    console.log('Adding a dataset to the local storage');
                    console.log(dataset);
                    var allDatasets = this.getDatasetsFromLocalStorage();
                    // allDatasets.forEach(function(dset, index) {
                Severity: Major
                Found in src/app.js and 1 other location - About 2 hrs to fix
                src/app.js on lines 367..376

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

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

                  zenodoRequest: async function(zenodoParams) {
                
                    var url_addition = zenodoParams.url_addition;
                    var requestType = zenodoParams.requestType;
                    var bodyData = zenodoParams.bodyData;
                Severity: Major
                Found in src/app.js - About 2 hrs to fix

                  Function update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function update (view) {
                    if (!view.isInitialized) {
                      return;
                    }
                  
                  
                  Severity: Minor
                  Found in src/widgets/views/chartjs1d.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

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

                    events: {
                      'click [data-hook~=group-order-count]': function () {
                        this.model.ordering = 'count';
                        this.parent.resetFilter = true;
                      },
                  Severity: Major
                  Found in src/pages/configure-partition/partition-categorial.js and 1 other location - About 2 hrs to fix
                  src/pages/configure-partition/partition-text.js on lines 12..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 86.

                  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

                    events: {
                      'click [data-hook~=group-order-count]': function () {
                        this.model.ordering = 'count';
                        this.parent.resetFilter = true;
                      },
                  Severity: Major
                  Found in src/pages/configure-partition/partition-text.js and 1 other location - About 2 hrs to fix
                  src/pages/configure-partition/partition-categorial.js on lines 19..28

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

                  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

                  var DurationUnitsView = View.extend({
                    template: '<option data-hook="option"> </option>',
                    render: function () {
                      this.renderWithTemplate(this);
                    },
                  Severity: Major
                  Found in src/pages/configure-facet/duration-units-select.js and 1 other location - About 2 hrs to fix
                  src/pages/configure-facet/time-parts-select.js on lines 7..25

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

                  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

                  var TimePartView = View.extend({
                    template: '<option data-hook="option"> </option>',
                    render: function () {
                      this.renderWithTemplate(this);
                    },
                  Severity: Major
                  Found in src/pages/configure-facet/time-parts-select.js and 1 other location - About 2 hrs to fix
                  src/pages/configure-facet/duration-units-select.js on lines 7..25

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

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

                      buildTicks: function () {
                        var me = this;
                  
                        me.ctx.save();
                        var tickFontSize = helpers.getValueOrDefault(me.options.ticks.fontSize, Chart.defaults.global.defaultFontSize);
                  Severity: Major
                  Found in src/widgets/chartjs-duration-scale.js - About 2 hrs to fix

                    Function uploadSessionZenodo has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      uploadSessionZenodo: function () {
                    
                        var that = this;
                    
                        var json = app.me.toJSON();
                    Severity: Major
                    Found in src/pages/datasets.js - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language