jiskattema/spot

View on GitHub
src/pages/analyze.js

Summary

Maintainability
D
1 day
Test Coverage

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

      Function addWidgetForFilter has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function addWidgetForFilter (view, filter, editModeHint) {
        var gridster = view._widgetsGridster;
        var row = filter.row || 1;
        var col = filter.col || 1;
        var sizeX = filter.size_x || 3;
      Severity: Minor
      Found in src/pages/analyze.js - About 1 hr to fix

        Function initializeCharts has 28 lines of code (exceeds 25 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 1 hr to fix

          Function renderContent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            renderContent: function () {
              var widgetNeedsData = false;
          
              var el = document.getElementById('facetBar');
              this._facetsSortable = sortablejs.create(el, {
          Severity: Minor
          Found in src/pages/analyze.js - About 55 mins 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 addWidgetForFilter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function addWidgetForFilter (view, filter, editModeHint) {
            var gridster = view._widgetsGridster;
            var row = filter.row || 1;
            var col = filter.col || 1;
            var sizeX = filter.size_x || 3;
          Severity: Minor
          Found in src/pages/analyze.js - About 45 mins 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

          There are no issues that match your filters.

          Category
          Status