Showing 544 of 841 total issues
Consider simplifying this complex logical expression. Open
Open
if (dsMeta.bar && this.chart.isDatasetVisible(j) &&
(yScale.options.stacked === false ||
(yScale.options.stacked === true && stacks.indexOf(dsMeta.stack) === -1) ||
(yScale.options.stacked === undefined && (dsMeta.stack === undefined || stacks.indexOf(dsMeta.stack) === -1)))) {
stacks.push(dsMeta.stack);
Consider simplifying this complex logical expression. Open
Open
if (e.type && e.type.toLowerCase() === 'keydown') {
keyCode = e.keyCode;
printable = (
(keyCode >= 97 && keyCode <= 122) || // a-z
(keyCode >= 65 && keyCode <= 90) || // A-Z
Function mergeOptions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function mergeOptions (
parent,
child,
vm
) {
Function parseEndTag
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseEndTag (tag, tagName, start, end) {
var pos;
if (start == null) { start = index; }
if (end == null) { end = index; }
Function exports
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(Chart) {
var defaultConfig = {
hover: {
mode: 'single'
Function Watcher
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Watcher = function Watcher (
vm,
expOrFn,
cb,
options
Function monthOrYearChanged
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
monthOrYearChanged: function(e) {
var isLeft = $(e.target).closest('.calendar').hasClass('left'),
leftOrRight = isLeft ? 'left' : 'right',
cal = this.container.find('.calendar.'+leftOrRight);
Function jsOptionsFunc
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle) {
return function (chart, opts, chartOptions) {
var series = chart.data;
var options = merge({}, defaultOptions);
options = merge(options, chartOptions || {});
Function addClass
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addClass: function( value ) {
var classes, elem, cur, clazz, j, finalValue,
i = 0,
len = this.length,
proceed = typeof value === "string" && value;
Function fixCloneNodeIssues
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
Function load
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
Function removeClass
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
removeClass: function( value ) {
var classes, elem, cur, clazz, j, finalValue,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
Function data
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
data: function( key, value ) {
var i, name, data,
elem = this[0],
attrs = elem && elem.attributes;
Function normalizeChildren
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function normalizeChildren (
children,
ns,
nestedIndex
) {
Function stateMixin
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function stateMixin (Vue) {
// flow somehow has problems with directly declared definition object
// when using Object.defineProperty, so we have to procedurally build up
// the object here.
var dataDef = {};
Function initCanvas
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function initCanvas(canvas, config) {
var style = canvas.style;
// NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it
// returns null or '' if no explicit value has been set to the canvas attribute.
Method anomaly?
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def anomaly?(series)
series = series.reject { |v| v[0].nil? }.sort_by { |v| v[0] }
csv_str =
CSV.generate do |csv|
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function(templateName, data) {
var value, id, label;
var html = '';
var cache = false;
var self = this;
Method home
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def home
if params[:filter] == "dashboards"
@queries = []
else
set_queries(1000)
- 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
Method update_dashboard
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def update_dashboard(dashboard)
dashboard.assign_attributes(dashboard_params)
Blazer::Dashboard.transaction do
if params[:query_ids].is_a?(Array)
query_ids = params[:query_ids].map(&:to_i)
- 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"