Showing 151 of 176 total issues
Avoid deeply nested control flow statements. Open
if (stringIds) {
var ids = stringIds.split(",");
fetchResults(ids);
}
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
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 take_snapshot
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def take_snapshot(env, start)
MiniProfiler.create_current(env, @config)
Thread.current[:mp_ongoing_snapshot] = true
results = @app.call(env)
status = results[0].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"
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
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 (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
var out=' '; var data = it.data; out+=' '; var customFieldsNames = it.allCustomFieldsNames; out+=' ';if(data.list && data.list.length){out+=' <h2>Snapshots for '+( data.group_name )+'</h2> <table class="snapshots-table"> <thead> <tr> <th>ID</th> <th>Duration (ms)</th> <th>SQL Count</th> ';var arr1=customFieldsNames;if(arr1){var name,i1=-1,l1=arr1.length-1;while(i1<l1){name=arr1[i1+=1];out+=' <th>'+( name )+'</th> ';} } out+=' <th>Age</th> </tr> </thead> <tbody> ';var arr2=data.list;if(arr2){var row,i2=-1,l2=arr2.length-1;while(i2<l2){row=arr2[i2+=1];out+=' <tr> <td><a href="'+( row.url )+'"> '+( row.id )+' </a></td> <td>'+( MiniProfiler.formatDuration(row.duration) )+'</td> <td>'+( row.sql_count )+'</td> ';var arr3=customFieldsNames;if(arr3){var name,i3=-1,l3=arr3.length-1;while(i3<l3){name=arr3[i3+=1];out+=' <td>'+( row.custom_fields[name] || "" )+'</td> ';} } out+=' <td> ';if(row.timestamp){out+=' '+( MiniProfiler.timestampToRelative(row.timestamp) )+' ';}out+=' </td> </tr> ';} } out+=' </tbody> </table> ';}else{out+=' <h2>No snapshots for '+( data.group_name )+'</h2> ';}return out;
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 (!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
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];
Method add_sql
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_sql(query, elapsed_ms, page, params = nil, skip_backtrace = false, full_backtrace = false)
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
Function anonymous
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
MiniProfiler.templates["snapshotsGroupsList"] = function anonymous(it
) {
var out=' ';if(it.list && it.list.length){out+=' <table class="snapshots-table"> <thead> <tr> <th>Requests Group</th> <th>Worst Time (ms)</th> <th>Best Time (ms)</th> <th>No. of Snapshots</th> </tr> </thead> <tbody> ';var arr1=it.list;if(arr1){var row,i1=-1,l1=arr1.length-1;while(i1<l1){row=arr1[i1+=1];out+=' <tr> <td class="request-group"><a href="'+( row.url )+'">'+( row.name )+'</a></td> <td>'+( MiniProfiler.formatDuration(row.worst_score) )+'</td> <td>'+( MiniProfiler.formatDuration(row.best_score) )+'</td> <td>'+( row.snapshots_count )+'</td> </tr> ';} } out+=' </tbody> </table> ';}else{out+=' <h2>No snapshots exist</h2> ';}return out;
}
- 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 (null === K) {
d = document.createElement("PRE");
d.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));
K = !/</.test(d.innerHTML);
}
Avoid deeply nested control flow statements. Open
if (null === K) {
d = document.createElement("PRE");
d.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));
K = !/</.test(d.innerHTML);
}
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
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"