christabor/flask_jsondash

View on GitHub

Showing 92 of 92 total issues

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

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

          $.each(oldp ? oldp.split('&'): [], function(i, param){
              param = param.split('=');
              oldparams[param[0]] = param[1];
          });
      Severity: Major
      Found in flask_jsondash/static/js/utils.js and 1 other location - About 1 hr to fix
      flask_jsondash/static/js/utils.js on lines 56..59

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

      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

          $.each(newp ? newp.split('&'): [], function(i, param){
              param = param.split('=');
              newparams[param[0]] = param[1];
          });
      Severity: Major
      Found in flask_jsondash/static/js/utils.js and 1 other location - About 1 hr to fix
      flask_jsondash/static/js/utils.js on lines 52..55

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

      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

                  d3.map(bootstrap_classes, function(i){
                      var classes = {};
                      classes['col-md-' + i] = false;
                      classes['col-lg-' + i] = false;
                      sel.classed(classes);
      Severity: Major
      Found in flask_jsondash/static/js/app.js and 1 other location - About 1 hr to fix
      flask_jsondash/static/js/app.js on lines 258..263

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

      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

                  d3.map(classes, function(colcount){
                      var classlist = {};
                      classlist['col-md-' + colcount] = true;
                      classlist['col-lg-' + colcount] = true;
                      sel.classed(classlist);
      Severity: Major
      Found in flask_jsondash/static/js/app.js and 1 other location - About 1 hr to fix
      flask_jsondash/static/js/app.js on lines 267..272

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

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

                Function populateEditForm has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function populateEditForm(e) {
                        // If the modal caller was the add modal button, skip populating the field.
                        API_PREVIEW.text('...');
                        clearForm();
                        if(isModalButton(e) || isRowButton(e)) {
                Severity: Minor
                Found in flask_jsondash/static/js/app.js - About 1 hr to fix

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

                      var svg = container
                          .select('.chart-container')
                          .append('svg')
                          .classed(jsondash.util.getCSSClasses(config))
                          .attr('width', radius)
                  Severity: Major
                  Found in flask_jsondash/static/js/handlers.js and 2 other locations - About 1 hr to fix
                  flask_jsondash/static/js/handlers.js on lines 590..595
                  flask_jsondash/static/js/handlers.js on lines 635..640

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

                  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 3 locations. Consider refactoring.
                  Open

                          var svg = container
                              .select('.chart-container')
                              .append('svg')
                              .classed(jsondash.util.getCSSClasses(config))
                              .attr('width', width)
                  Severity: Major
                  Found in flask_jsondash/static/js/handlers.js and 2 other locations - About 1 hr to fix
                  flask_jsondash/static/js/handlers.js on lines 540..545
                  flask_jsondash/static/js/handlers.js on lines 590..595

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

                  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 3 locations. Consider refactoring.
                  Open

                      var svg = container
                          .select('.chart-container')
                          .append('svg')
                          .classed(jsondash.util.getCSSClasses(config))
                          .attr('width', width)
                  Severity: Major
                  Found in flask_jsondash/static/js/handlers.js and 2 other locations - About 1 hr to fix
                  flask_jsondash/static/js/handlers.js on lines 540..545
                  flask_jsondash/static/js/handlers.js on lines 635..640

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

                  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 validate_raw_json has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def validate_raw_json(jsonstr, **overrides):
                      """Validate the raw json for a config.
                  
                      Args:
                          jsonstr (str): The raw json 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

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

                      container
                          .select('.chart-container')
                          .append('iframe')
                          .classed(jsondash.util.getCSSClasses(config))
                          .attr('width', width)
                  Severity: Major
                  Found in flask_jsondash/static/js/handlers.js and 1 other location - About 1 hr to fix
                  flask_jsondash/static/js/handlers.js on lines 431..437

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

                  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 svg = container
                          .select('.chart-container')
                          .append('svg')
                          .classed(jsondash.util.getCSSClasses(config))
                          .attr('width', diameter)
                  Severity: Major
                  Found in flask_jsondash/static/js/handlers.js and 1 other location - About 1 hr to fix
                  flask_jsondash/static/js/handlers.js on lines 227..233

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

                  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

                              assets['css'] += [
                                  css for css in data['css_url'] if css not in assets['css']]
                  Severity: Major
                  Found in flask_jsondash/charts_builder.py and 1 other location - About 1 hr to fix
                  flask_jsondash/charts_builder.py on lines 237..238

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language