Showing 151 of 176 total issues
Method trim_binds
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def trim_binds(binds)
max_len = Rack::MiniProfiler.config.max_sql_param_length
return if binds.nil? || max_len == 0
return binds.map { |(name, val)| [name, val] } if max_len.nil?
binds.map do |(name, val)|
- 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 initialize!
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.initialize!(app)
raise "MiniProfilerRails initialized twice. Set `require: false' for rack-mini-profiler in your Gemfile" if defined?(@already_initialized) && @already_initialized
c = Rack::MiniProfiler.config
Function prettyPrint
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.prettyPrint = function (b) {
function f() {
for (var t = window.PR_SHOULD_USE_CONTINUATION ? j.now() + 250 : Infinity; q < o.length && j.now() < t; q++) {
var p = o[q];
Function prettyPrint
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.prettyPrint = function (b) {
function f() {
for (var t = window.PR_SHOULD_USE_CONTINUATION ? j.now() + 250 : Infinity; q < o.length && j.now() < t; q++) {
var p = o[q];
Class RedisStore
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class RedisStore < AbstractStore
attr_reader :prefix
EXPIRES_IN_SECONDS = 60 * 60 * 24
Function toggleShortcutEvent
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
var toggleShortcutEvent = function toggleShortcutEvent(e) {
// simplified version of https://github.com/jeresig/jquery.hotkeys/blob/master/jquery.hotkeys.js
var shortcut = options.toggleShortcut.toLowerCase();
var modifier = "";
["alt", "ctrl", "shift"].forEach(function(k) {
File redis_store.rb
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'digest'
require 'securerandom'
module Rack
class MiniProfiler
Function buttonShow
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
var buttonShow = function buttonShow(json) {
var result = renderTemplate(json);
totalTime += parseFloat(json.duration_milliseconds, 10);
totalSqlCount += parseInt(json.sql_count);
reqs++;
Function U
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function U(b) {
var f = b.f,
i = b.e;
b.a = f;
Function U
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function U(b) {
var f = b.f,
i = b.e;
b.a = f;
Function fetchResults
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
var fetchResults = function fetchResults(ids) {
var clientPerformance, clientProbes, i, j, p, id, idx;
for (i = 0; i < ids.length; i++) {
id = ids[i];
Function $
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $(b) {
function f(D) {
if (D > r) {
if (j && j !== q) {
n.push("</span>");
Function $
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $(b) {
function f(D) {
if (D > r) {
if (j && j !== q) {
n.push("</span>");
Function B
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
function B(b, f) {
var i = {},
o;
(function () {
Function B
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
function B(b, f) {
var i = {},
o;
(function () {
Method init_from_form_data
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.init_from_form_data(env, page_struct)
timings = []
clientTimes, clientPerf, baseTime = nil
form = env['rack.request.form_hash']
- 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 f
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function f() {
for (var t = window.PR_SHOULD_USE_CONTINUATION ? j.now() + 250 : Infinity; q < o.length && j.now() < t; q++) {
var p = o[q];
if (p.className && p.className.indexOf("prettyprint") >= 0) {
Method push_snapshot
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def push_snapshot(page_struct, group_name, config)
group_zset_key = group_snapshot_zset_key(group_name)
group_hash_key = group_snapshot_hash_key(group_name)
overview_zset_key = snapshot_overview_zset_key
Function f
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function f() {
for (var t = window.PR_SHOULD_USE_CONTINUATION ? j.now() + 250 : Infinity; q < o.length && j.now() < t; q++) {
var p = o[q];
if (p.className && p.className.indexOf("prettyprint") >= 0) {
Method initialize
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def initialize(query, duration_ms, page, parent, params = nil, skip_backtrace = false, full_backtrace = false)
stack_trace = nil
unless skip_backtrace || duration_ms < Rack::MiniProfiler.config.backtrace_threshold_ms
# Allow us to filter the stack trace
- 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"