jiskattema/spot

View on GitHub

Showing 81 of 2,641 total issues

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

    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

        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

        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

          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

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

                    chartjsConfig: function () {
                      return {
                        type: 'horizontalBarError',
                        data: {
                          datasets: [],
                  Severity: Minor
                  Found in src/widgets/models/horizontalbarchart.js - About 1 hr to fix

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

                    function initChart (view) {
                      // Configure plot
                      view._config = view.model.scatterConfig();
                    
                      var filter = view.model.filter;
                    Severity: Minor
                    Found in src/widgets/views/scatter.js - About 1 hr to fix

                      Function initialize has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        initialize: function () {
                          this.slots.reset([
                            {
                              description: 'X axis',
                              type: 'partition',
                      Severity: Minor
                      Found in src/widgets/models/bubbleplot.js - About 1 hr to fix

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

                          chartjsConfig: function () {
                            return {
                              type: 'barError',
                              data: {
                                datasets: [],
                        Severity: Minor
                        Found in src/widgets/models/barchart.js - About 1 hr to fix

                          Function initialize has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            initialize: function () {
                              this.slots.reset([
                                {
                                  description: 'X axis',
                                  type: 'partition',
                          Severity: Minor
                          Found in src/widgets/models/linechart.js - About 1 hr to fix

                            Function onload has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                reader.onload = function (ev) {
                                  app.message({
                                    text: 'Processing',
                                    type: 'ok'
                                  });
                            Severity: Minor
                            Found in src/app.js - About 1 hr to fix

                              Function startHelp has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                startHelp: function () {
                              
                                  console.log(app.currentPage.helpTemplate);
                                  console.log(app.currentPage.helpHints);
                                  console.log(app.currentPage.helpSteps);
                              Severity: Minor
                              Found in src/app.js - About 1 hr to fix

                                Function determineDataLimits has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    determineDataLimits: function () {
                                      var me = this;
                                      me.labelMoments = [];
                                
                                      // Get min max from labels
                                Severity: Minor
                                Found in src/widgets/chartjs-duration-scale.js - About 1 hr to fix

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

                                  function update (view) {
                                    if (!view.isInitialized) {
                                      console.warn('Cannot update chart, not initialized', view);
                                      return;
                                    }
                                  Severity: Minor
                                  Found in src/widgets/views/chartjs.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