Showing 151 of 176 total issues
Method profile_method
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def profile_method(klass, method, type = :profile, &blk)
default_name = type == :counter ? method.to_s : klass.to_s + " " + method.to_s
clean = clean_method_name(method)
with_profiling = ("#{clean}_with_mini_profiler").intern
- 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 o
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function o(c) {
var d = c.substring(1, c.length - 1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]", "g"));
c = [];
for (var a = [], k = d[0] === "^", e = k ? 1 : 0, h = d.length; e < h; ++e) {
Function o
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function o(c) {
var d = c.substring(1, c.length - 1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]", "g"));
c = [];
for (var a = [], k = d[0] === "^", e = k ? 1 : 0, h = d.length; e < h; ++e) {
Method get_profile_script
has 50 lines of code (exceeds 25 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)
Method inject_profiler
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def inject_profiler(env, status, headers, body)
# mini profiler is meddling with stuff, we can not cache cause we will get incorrect data
# Rack::ETag has already inserted some nonesense in the chain
content_type = headers['Content-Type']
- 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 toggleHidden
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
var toggleHidden = function toggleHidden(popup) {
var trivial = popup.querySelector(".profiler-toggle-trivial");
var childrenTime = popup.querySelector(
".profiler-toggle-duration-with-children"
);
Method default
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.default
new.instance_eval {
@auto_inject = true # automatically inject on every html page
@base_url_path = "/mini-profiler-resources/".dup
@cookie_path = "/".dup
Method analyze_memory
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def analyze_memory
require 'objspace'
utf8 = "utf-8"
Method profile_gc
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def profile_gc(app, env)
# for memsize_of
require 'objspace'
Method serve_snapshot
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def serve_snapshot(env)
MiniProfiler.authorize_request
status = 200
headers = { 'Content-Type' => 'text/html' }
qp = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
Method write!
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def write!(headers)
tokens_changed = false
if MiniProfiler.request_authorized? && MiniProfiler.config.authorization_mode == :allow_authorized
- 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 n
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function n(r) {
for (var j = r.c, q = [j, z], m = 0, t = r.source.match(o) || [], p = {}, c = 0, d = t.length; c < d; ++c) {
var a = t[c],
k = p[a],
e = void 0,
Function n
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function n(r) {
for (var j = r.c, q = [j, z], m = 0, t = r.source.match(o) || [], p = {}, c = 0, d = t.length; c < d; ++c) {
var a = t[c],
k = p[a],
e = void 0,
Function fetch
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.fetch = function(input, init) {
var originalFetchRun = __originalFetch(input, init);
originalFetchRun.then(function(response) {
try {
Method profile_method
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def profile_method(klass, method, type = :profile, &blk)
default_name = type == :counter ? method.to_s : klass.to_s + " " + method.to_s
clean = clean_method_name(method)
with_profiling = ("#{clean}_with_mini_profiler").intern
Method init_from_form_data
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.init_from_form_data(env, page_struct)
timings = []
clientTimes, clientPerf, baseTime = nil
form = env['rack.request.form_hash']
Method initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(env, store, start)
@request = ::Rack::Request.new(env)
@cookie = @request.cookies[COOKIE_NAME]
@store = store
@start = start
- 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 analyze_memory
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def analyze_memory
require 'objspace'
utf8 = "utf-8"
- 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 a Cognitive Complexity of 13 (exceeds 5 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
- 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 a Cognitive Complexity of 13 (exceeds 5 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
- 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"