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;
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;
- Read upRead up
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.
*/
File handlers.js
has 762 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** global: jsondash */
/** global: c3 */
/** global: d3 */
/** global: venn */
/** global: Plotly */
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;
File charts_builder.py
has 386 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""
flask_jsondash.charts_builder
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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;
File schema.py
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""
flask_jsondash.schema
~~~~~~~~~~~~~~~~~~~~~
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',
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,
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'))
- Read upRead up
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);
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
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;
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.
- Read upRead up
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
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;
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 = {};
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
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;