Showing 1,298 of 1,828 total issues
File redis_cache_store.rb
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
begin
gem "redis", ">= 4.0.1"
require "redis"
require "redis/distributed"
rescue LoadError
Method new_time
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def new_time(year, mon, mday, hour, min, sec, microsec, offset = nil)
# Treat 0000-00-00 00:00:00 as nil.
return if year.nil? || (year == 0 && mon == 0 && mday == 0)
if offset
- 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 exec_stmt_and_free
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def exec_stmt_and_free(sql, name, binds, cache_stmt: false, async: false)
sql = transform_query(sql)
check_if_write_query(sql)
mark_transaction_written_if_write(sql)
- 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 determine_template
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def determine_template(options)
keys = options.has_key?(:locals) ? options[:locals].keys : []
if options.key?(:body)
Template::Text.new(options[:body])
- 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 parse_render_from_options
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def parse_render_from_options(options_hash)
renders = []
keys = options_hash.keys
if (keys & RENDER_TYPE_KEYS).size < 1
- 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 insertFromPaste
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
insertFromPaste() {
var _dataTransfer$files;
const {
dataTransfer
} = this.event;
Class Errors
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Errors
include Enumerable
extend Forwardable
Class Base
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
include Callbacks
include PeriodicTimers
include Streams
include Naming
Class FlashHash
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class FlashHash
include Enumerable
def self.from_session_value(value) # :nodoc:
case value
Class ContentSecurityPolicy
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class ContentSecurityPolicy
class Middleware
def initialize(app)
@app = app
end
Class FormBuilder
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class FormBuilder
include ModelNaming
# The methods which wrap a form helper call.
class_attribute :field_helpers, default: [
File errors.rb
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveRecord
# = Active Record Errors
#
# Generic Active Record exception class.
class ActiveRecordError < StandardError
Method yield_shares
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def yield_shares(purpose: nil, compatible: [], block_share: false)
loose_shares = previous_wait = nil
synchronize do
if loose_shares = @sharing.delete(Thread.current)
if previous_wait = @waiting[Thread.current]
- 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 validate_each
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attr_name, value, precision: Float::DIG, scale: nil)
unless is_number?(value, precision, scale)
record.errors.add(attr_name, :not_a_number, **filtered_options(value))
return
end
- 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 assign_nested_attributes_for_one_to_one_association
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def assign_nested_attributes_for_one_to_one_association(association_name, attributes)
if attributes.respond_to?(:permitted?)
attributes = attributes.to_h
end
- 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 build_where_clause
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def build_where_clause(opts, rest = []) # :nodoc:
opts = sanitize_forbidden_attributes(opts)
if opts.is_a?(Array)
opts, *rest = opts
- 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 join_constraints
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def join_constraints(foreign_table, foreign_klass, join_type, alias_tracker)
joins = []
chain = []
reflection.chain.each do |reflection|
- 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 preview
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def preview
if params[:path] == @preview.preview_name
@page_title = "Action Mailer Previews for #{@preview.preview_name}"
render action: "mailer"
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
File form_tag_helper.rb
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "cgi"
require "action_view/helpers/content_exfiltration_prevention_helper"
require "action_view/helpers/url_helper"
require "action_view/helpers/text_helper"
require "active_support/core_ext/string/output_safety"
Function handleRemoteWithRails
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleRemoteWithRails = rails => function(e) {
let data, method, url;
const element = this;
if (!isRemote(element)) {
return true;