Showing 151 of 176 total issues
Function onClickEvents
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
var onClickEvents = function onClickEvents(e) {
// this happens on every keystroke, and :visible is crazy expensive in IE <9
// and in this case, the display:none check is sufficient.
var popup = toArray(document.querySelectorAll(".profiler-popup")).filter(
function(el) {
Method flush_buffer
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def flush_buffer
buffer_content = @buffer_mutex.synchronize do
@buffer.dup if @buffer.size > 0
end
if buffer_content
Method initialize
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(env)
timer_id = MiniProfiler.generate_id
started_at = (Time.now.to_f * 1000).to_i
started = (Process.clock_gettime(Process::CLOCK_MONOTONIC) * 1000).to_i
machine_name = env['SERVER_NAME']
Method initialize
has 34 lines of code (exceeds 25 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
Function initControls
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initControls = function initControls(container) {
if (options.showControls) {
var _controls = document.createElement("div");
_controls.classList.add("profiler-controls");
Function toQueryString
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
var toQueryString = function toQueryString(data, parentKey) {
var result = [];
for (var key in data) {
var val = data[key];
var newKey = !parentKey ? key : parentKey + "[" + key + "]";
Function H
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function H(b, f, i) {
switch (b.nodeType) {
case 1:
var o = b.tagName.toLowerCase();
f.push("<", o);
Function H
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function H(b, f, i) {
switch (b.nodeType) {
case 1:
var o = b.tagName.toLowerCase();
f.push("<", o);
Method binds_to_params
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def binds_to_params(binds)
return if binds.nil? || config.max_sql_param_length == 0
# map ActiveRecord::Relation::QueryAttribute to [name, value]
params = binds.map { |c| c.kind_of?(Array) ? [c.first, c.last] : [c.name, c.value] }
if (skip = config.skip_sql_param_names)
- 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 render_notification_handler
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_notification_handler(name, finish, start, name_as_description: false)
return if !should_measure?
description = name_as_description ? name : "Rendering: #{name}"
current = Rack::MiniProfiler.current.current_timer
Method serve_results
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def serve_results(env)
request = Rack::Request.new(env)
id = request.params['id']
group_name = request.params['group']
is_snapshot = group_name && group_name.size > 0
Method initialize
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(name, page, parent)
start_millis = (Process.clock_gettime(Process::CLOCK_MONOTONIC) * 1000).to_i - page[:started]
depth = parent ? parent.depth + 1 : 0
super(
id: MiniProfiler.generate_id,
Function getClientTimings
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
getClientTimings: function getClientTimings(clientTimings) {
var list = [];
var t;
if (!clientTimings.timings) return [];
Function f
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function f(c) {
if (c.charAt(0) !== "\\") return c.charCodeAt(0);
switch (c.charAt(1)) {
case "b":
Method push_snapshot
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def push_snapshot(page_struct, group_name, config)
@snapshots_lock.synchronize do
group = @snapshot_groups[group_name]
if !group
@snapshot_groups[group_name] = {
Method initialize
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(args = nil)
args ||= {}
@path = args[:path]
@expires_in_seconds = args[:expires_in] || EXPIRES_IN_SECONDS
raise ArgumentError.new :path unless @path
Function f
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function f(c) {
if (c.charAt(0) !== "\\") return c.charCodeAt(0);
switch (c.charAt(1)) {
case "b":
Method allowed_tokens
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def allowed_tokens
token_info = @client.get("#{@prefix}-tokens")
key1, key2, cycle_at = nil
- 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 get_profile_script
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_profile_script(env, response_headers = {})
path = public_base_path(env)
version = MiniProfiler::ASSET_VERSION
if @config.assets_url
url = @config.assets_url.call('rack-mini-profiler.js', version, env)
- 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 send
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
XMLHttpRequest.prototype.send = function(data) {
ajaxStartTime = new Date();
this.addEventListener("load", function() {
// responseURL isn't available in IE11
if (