christabor/flask_jsondash

View on GitHub

Showing 54 of 92 total issues

Function jsondash has 839 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var jsondash = function() {
    var my = {
        chart_wall: null
    };
    var MIN_CHART_SIZE   = 200;
Severity: Major
Found in flask_jsondash/static/js/app.js - About 4 days to fix

    Function jsondash has a Cognitive Complexity of 145 (exceeds 5 allowed). Consider refactoring.
    Open

    var jsondash = function() {
        var my = {
            chart_wall: null
        };
        var MIN_CHART_SIZE   = 200;
    Severity: Minor
    Found in flask_jsondash/static/js/app.js - About 2 days 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 841 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /** global: d3 */
    /**
     * Bootstrapping functions, event handling, etc... for application.
     */
    
    
    Severity: Major
    Found in flask_jsondash/static/js/app.js - About 2 days to fix

      File handlers.js has 762 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /** global: jsondash */
      /** global: c3 */
      /** global: d3 */
      /** global: venn */
      /** global: Plotly */
      Severity: Major
      Found in flask_jsondash/static/js/handlers.js - About 1 day to fix

        Function Widget has 149 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function Widget(container, config) {
                // model for a chart widget
                var self = this;
                self.config = config;
                self.guid = self.config.guid;
        Severity: Major
        Found in flask_jsondash/static/js/app.js - About 5 hrs to fix

          File charts_builder.py has 386 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          
          """
          flask_jsondash.charts_builder
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          Severity: Minor
          Found in flask_jsondash/charts_builder.py - About 5 hrs to fix

            Function Widgets has 105 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function Widgets() {
                    var self = this;
                    self.widgets = {};
                    self.url_cache = {};
                    self.container = MAIN_CONTAINER.selector;
            Severity: Major
            Found in flask_jsondash/static/js/app.js - About 4 hrs to fix

              File schema.py has 295 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              
              """
              flask_jsondash.schema
              ~~~~~~~~~~~~~~~~~~~~~
              Severity: Minor
              Found in flask_jsondash/schema.py - About 3 hrs to fix

                Function handleC3 has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                jsondash.handlers.handleC3 = function(container, config) {
                    var _width = isNaN(config.width) ? jsondash.getDynamicWidth(container, config) : config.width;
                    'use strict';
                    var init_config = {
                        bindto: '[data-guid="' + config.guid + '"] .chart-container',
                Severity: Major
                Found in flask_jsondash/static/js/handlers.js - About 2 hrs to fix

                  Function handleTreemap has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  jsondash.handlers.handleTreemap = function(container, config) {
                      'use strict';
                      // Adapted from http://bl.ocks.org/mbostock/4063582
                      var margin = {
                          top: jsondash.config.WIDGET_MARGIN_Y / 2,
                  Severity: Major
                  Found in flask_jsondash/static/js/handlers.js - About 2 hrs to fix

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

                    def update(c_id):
                        """Normalize the form POST and setup the json view config object."""
                        if not auth(authtype='update'):
                            flash('You do not have access to update dashboards.', 'error')
                            return redirect(url_for('jsondash.dashboard'))
                    Severity: Minor
                    Found in flask_jsondash/charts_builder.py - 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 addDomEvents has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function addDomEvents() {
                            MAIN_FORM.find('[name="mode"]').on('change.charts.row', chartsModeChanged);
                            WIDGET_FORM.find('[name="row"]').on('change.charts.row', chartsRowChanged);
                            // Chart type change
                            WIDGET_FORM.find('[name="type"]').on('change.charts.type', chartsTypeChanged);
                    Severity: Major
                    Found in flask_jsondash/static/js/app.js - About 2 hrs to fix

                      Function handleNumbersGroup has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      jsondash.handlers.handleNumbersGroup = function(container, config) {
                          'use strict';
                          var scale = d3.scale.linear()
                              .clamp(true)
                              .domain([1, 20]) // min/max digits length
                      Severity: Minor
                      Found in flask_jsondash/static/js/handlers.js - About 1 hr to fix

                        Function handleWordCloud has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        jsondash.handlers.handleWordCloud = function(container, config) {
                            'use strict';
                            jsondash.getJSON(container, config, function(error, data){
                                var h     = config.height - jsondash.config.WIDGET_MARGIN_Y;
                                var w     = config.width - jsondash.config.WIDGET_MARGIN_X;
                        Severity: Minor
                        Found in flask_jsondash/static/js/handlers.js - About 1 hr to fix

                          Function validate_raw_json_grid has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def validate_raw_json_grid(conf):
                              """Grid mode specific validations.
                          
                              Args:
                                  conf (dict): The dashboard configuration.
                          Severity: Minor
                          Found in flask_jsondash/schema.py - 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

                          Function handleDendrogram has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          jsondash.handlers.handleDendrogram = function(container, config) {
                              'use strict';
                              var _width = isNaN(config.width) ? jsondash.getDynamicWidth(container, config) : config.width;
                              // A general padding for the svg inside of the widget.
                              // The cluster dendrogram will also need to have padding itself, so
                          Severity: Minor
                          Found in flask_jsondash/static/js/handlers.js - About 1 hr to fix

                            Function handleRadialDendrogram has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            jsondash.handlers.handleRadialDendrogram = function(container, config) {
                                'use strict';
                                // Code taken (and refactored for use here) from:
                                // https://bl.ocks.org/mbostock/4339607
                                var _width = isNaN(config.width) ? jsondash.getDynamicWidth(container, config) : config.width;
                            Severity: Minor
                            Found in flask_jsondash/static/js/handlers.js - About 1 hr to fix

                              Function loadAll has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      self.loadAll = function() {
                                          // Don't run this on certain types that are not cacheable (e.g. binary, html)
                                          var config_urls = self.getAllOfPropUnless('dataSource', 'family', 'Basic');
                                          var unique_urls = d3.set(config_urls).values();
                                          var cached = {};
                              Severity: Minor
                              Found in flask_jsondash/static/js/app.js - About 1 hr to fix

                                Function handleSingleNum has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                jsondash.handlers.handleSingleNum = function(container, config) {
                                    'use strict';
                                    jsondash.getJSON(container, config, function(error, res){
                                        var data = res.data.data ? res.data.data : res.data;
                                        var num = container
                                Severity: Minor
                                Found in flask_jsondash/static/js/handlers.js - About 1 hr to fix

                                  Function load has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          self.load = function() {
                                              var widg      = my.widgets.get(self.guid);
                                              var widget    = self.el;
                                              var $widget   = self.$el;
                                              var config    = widg.config;
                                  Severity: Minor
                                  Found in flask_jsondash/static/js/app.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language