jiskattema/spot

View on GitHub

Showing 81 of 2,641 total issues

Function exports has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (Chart, moment) {
  var helpers = Chart.helpers;
  moment = moment || require('moment');

  var DurationScale = Chart.Scale.extend({
Severity: Minor
Found in src/widgets/chartjs-duration-scale.js - About 1 day 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 app.js has 589 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var Spot = require('spot-framework');
var app = require('ampersand-app');
var Router = require('./router');
var MainView = require('./pages/main');
var DatasetsView = require('./pages/datasets');
Severity: Major
Found in src/app.js - About 1 day to fix

    Function exports has 231 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (Chart, moment) {
      var helpers = Chart.helpers;
      moment = moment || require('moment');
    
      var DurationScale = Chart.Scale.extend({
    Severity: Major
    Found in src/widgets/chartjs-duration-scale.js - About 1 day to fix

      Function exports has 159 lines of code (exceeds 25 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: Major
      Found in src/widgets/chartjs-errorbars.js - About 6 hrs to fix

        Function resizeChartjsData has a Cognitive Complexity of 38 (exceeds 5 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: Minor
        Found in src/widgets/views/util.js - About 5 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 update has 122 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

          function prettyPrintDuration (tick) {
            var parts = [];
            var count;
            var remainder = moment.duration(tick);
          
          
          Severity: Minor
          Found in src/widgets/chartjs-duration-scale.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 updateBubbles has 114 lines of code (exceeds 25 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: Major
          Found in src/widgets/views/chartjs2d.js - About 4 hrs to fix

            Function renderContent has 91 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              renderContent: function () {
                var widgetNeedsData = false;
            
                var el = document.getElementById('facetBar');
                this._facetsSortable = sortablejs.create(el, {
            Severity: Major
            Found in src/pages/analyze.js - About 3 hrs to fix

              File datasets.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              var Spot = require('spot-framework');
              var PageView = require('./base');
              var templates = require('../templates');
              var app = require('ampersand-app');
              var $ = require('jquery');
              Severity: Minor
              Found in src/pages/datasets.js - About 3 hrs to fix

                File analyze.js has 304 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                var app = require('ampersand-app');
                var $ = require('jquery');
                var PageView = require('./base');
                var templates = require('../templates');
                var WidgetFrameView = require('./analyze/widget-frame');
                Severity: Minor
                Found in src/pages/analyze.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 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 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

                                Severity
                                Category
                                Status
                                Source
                                Language