Showing 151 of 176 total issues
Avoid deeply nested control flow statements. Open
if (this.readyState == 4) {
var stringIds = this.getResponseHeader("X-MiniProfiler-Ids");
if (stringIds) {
var ids = stringIds.split(",");
Avoid deeply nested control flow statements. Open
if (!ba.test(m)) if (ca.test(m)) {
f.push(m.substring(9, m.length - 3));
n += m.length - 12;
} else if (da.test(m)) {
f.push("\n");
Avoid deeply nested control flow statements. Open
if ((a.tagName === "pre" || a.tagName === "code" || a.tagName === "xmp") && a.className && a.className.indexOf("prettyprint") >= 0) {
d = true;
break;
}
Method other_patches
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.other_patches
patches = []
patches << 'mongo' if defined?(Mongo::Server::Connection) && Mongo.class == Module
patches << 'moped' if defined?(Moped::Node) && Moped::Node.class == Class
patches << 'plucky' if defined?(Plucky::Query) && Plucky::Query.class == Class
- 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 deeply nested control flow statements. Open
if (K) {
d = a.innerHTML;
if ("XMP" === a.tagName) d = y(d);else {
a = a;
if ("PRE" === a.tagName) a = true;else if (ka.test(d)) {
Avoid deeply nested control flow statements. Open
for (h = 0; h < l; ++h) {
g = f[h];
if (e = a.match(g[1])) {
k = g[0];
Avoid deeply nested control flow statements. Open
if (this.miniprofiler.prev_onreadystatechange !== null)
return this.miniprofiler.prev_onreadystatechange.apply(
this,
arguments
);
Method merge!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def merge!(config)
if config
if Hash === config
config.each { |k, v| instance_variable_set "@#{k}", v }
else
- 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 has_valid_cookie?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def has_valid_cookie?
valid_cookie = !@cookie.nil?
if (MiniProfiler.config.authorization_mode == :allow_authorized) && valid_cookie
begin
- 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 on_query
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_query(env)
if SqlPatches.should_measure?
not_indexed = env[:criteria] && env[:criteria].where_present? &&
!env[:criteria].where_indexed? &&
!env[:criteria].model.try(:perf_warnings_disabled)
- 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 deeply nested control flow statements. Open
for (h = 0; h < l; ++h) {
g = f[h];
if (e = a.match(g[1])) {
k = g[0];
Method symbolize_hash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def symbolize_hash(hash)
new_hash = {}
hash.each do |k, v|
sym_k = String === k ? k.to_sym : k
if Hash === v
- 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 inject
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def inject(fragment, script)
# find explicit or implicit body
index = fragment.rindex(/<\/body>/i) || fragment.rindex(/<\/html>/i)
if index
# if for whatever crazy reason we dont get a utf string,
- 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 deeply nested control flow statements. Open
for (var r = [], j = n; --j >= 0;) {
r[j] = l[j];
}
Avoid deeply nested control flow statements. Open
if (!ba.test(m)) if (ca.test(m)) {
f.push(m.substring(9, m.length - 3));
n += m.length - 12;
} else if (da.test(m)) {
f.push("\n");
Method set_unviewed
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_unviewed(user, id)
@client.add("#{@prefix}-#{user}-v", [], @expires_in_seconds)
MAX_RETRIES.times do
break if @client.cas("#{@prefix}-#{user}-v", @expires_in_seconds) do |ids|
ids << id unless ids.include?(id)
- 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 deeply nested control flow statements. Open
if ((a.tagName === "pre" || a.tagName === "code" || a.tagName === "xmp") && a.className && a.className.indexOf("prettyprint") >= 0) {
d = true;
break;
}
Method execute_with_profiling
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def execute_with_profiling(client, request_context)
return execute_without_profiling(client, request_context) unless SqlPatches.should_measure?
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
result = execute_without_profiling(client, request_context)
- 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 deeply nested control flow statements. Open
} else if ("\\" === g.charAt(0)) if ((g = +g.substring(1)) && g <= h) d[e] = "\\" + k[h];
Avoid deeply nested control flow statements. Open
if (stringIds) {
var ids = stringIds.split(",");
fetchResults(ids);
}