Showing 54 of 92 total issues
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)) {
Function local_static
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def local_static(chart_config, static_config):
"""Convert remote cdn urls to local urls, based on user provided paths.
The filename must be identical to the one specified in the
`settings.py` 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 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
- 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 handleCirclePack
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsondash.handlers.handleCirclePack = function(container, config) {
'use strict';
// Adapted from https://bl.ocks.org/mbostock/4063530
var margin = jsondash.config.WIDGET_MARGIN_Y;
var diameter = jsondash.getDiameter(container, config) - margin;
Function fitGrid
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fitGrid(grid_packer_opts, init) {
var packer_options = $.isPlainObject(grid_packer_opts) ? grid_packer_opts : {};
var grid_packer_options = $.extend({}, packer_options, {});
var drag_options = {
scroll: true,
Function handleVoronoi
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsondash.handlers.handleVoronoi = function(container, config) {
'use strict';
jsondash.getJSON(container, config, function(error, data){
var _width = isNaN(config.width) ? jsondash.getDynamicWidth(container, config) : config.width;
var width = _width - jsondash.config.WIDGET_MARGIN_X;
Function handlePlotly
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsondash.handlers.handlePlotly = function(container, config) {
'use strict';
var id = 'plotly-' + config.guid;
var _width = isNaN(config.width) ? jsondash.getDynamicWidth(container, config) : config.width;
container
Function intervalStrToMS
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsondash.util.intervalStrToMS = function(ival_fmt) {
if(ival_fmt === undefined || ival_fmt === '') {
return null;
}
// Just return number if it's a regular integer.
Function loadDashboard
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadDashboard(data) {
// Load the grid before rendering the ajax, since the DOM
// is rendered server side.
fitGrid({
columnWidth: 5,
Function dump_fixtures
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def dump_fixtures(path, delete_after=False):
"""Generate fixture data (json) from existing records in db.
Args:
name (path): The folder path to save configs in (must exist first!)
- 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 get_active_assets
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_active_assets(families):
"""Given a list of chart families, determine what needs to be loaded."""
families += REQUIRED_STATIC_FAMILES # Always load internal, shared libs.
assets = dict(css=[], js=[])
families = set(families)
- 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 handleVegaLite
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsondash.handlers.handleVegaLite = function(container, config) {
'use strict';
jsondash.getJSON(container, config, function(error, vlspec){
var SCALE_FACTOR = 0.7; // very important to get sizing jusst right.
var selector = '[data-guid="' + config.guid + '"] .chart-container';
Function url2wordcloud
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def url2wordcloud(url, requests_kwargs={},
Function view
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def view(c_id):
"""Load a json view config from the DB."""
if not auth(authtype='view', view_id=c_id):
flash('You do not have access to view this dashboard.', '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 insert_dashboards
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def insert_dashboards(records, max_charts, fixtures, dump, delete):
Function intervalStrToMS
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
jsondash.util.intervalStrToMS = function(ival_fmt) {
if(ival_fmt === undefined || ival_fmt === '') {
return null;
}
// Just return number if it's a regular integer.
- 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 metadata
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def metadata(key=None, exclude=[]):
"""An abstraction around misc. metadata.
This allows loose coupling for enabling and setting
metadata for each chart.
- 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 path_hierarchy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def path_hierarchy(path, hierarchy=[], prev=None):
"""Create a dotfile representation of a filesystem tree.
Format is suitable for graphviz applications.
"""
- 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
Avoid too many return
statements within this function. Open
if(config.type === 'custom') { return jsondash.handlers.handleCustom(container, config); }
Avoid too many return
statements within this function. Open
return amt * ms2day;