Showing 829 of 829 total issues
Method rejects
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def rejects(*fields)
r = false
fields.each do |field|
next unless send(field).present?
changed =
- 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_code
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_code
if code.blank?
errors.add(:code, "can't be blank")
else
logs = parse_code
- 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 mapping_schema
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def mapping_schema(target_data_type_id = nil)
sch = {
SCHEMA_FLAG.to_s => true,
type: 'object',
properties: {
- 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 post_digest_upload
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def post_digest_upload(request, options = {})
readable =
if request.content_type.downcase == 'multipart/form-data'
request.params[:data] || request.params[:file] || fail('Missing data (or file) part')
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 get_digest_switch_sudo
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_digest_switch_sudo(_request, options = {})
if has_role?(:super_admin)
if update(super_admin_enabled: !super_admin_enabled)
{
json: to_hash(options)
- 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 schema
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def schema
sch =
if type.blank?
{}
elsif (json_type = BASIC_TYPES[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
Method delete_digest_token
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def delete_digest_token(request, _options = {})
token = OauthAccessToken.where(id: request.params[:id], token: request.params[:token]).first
if token
if token.destroy
{
- 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 post_digest_cross
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def post_digest_cross(request, _options = {})
fail 'Unable to cross' unless model.is_a?(Class) && (
model < CrossOrigin::Document ||
model == Collection
)
- 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 post_digest
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def post_digest(request, _options = {})
begin
message = JSON.parse(request.body.read)
fail unless message.is_a?(Hash)
rescue
- 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 stored_properties_on
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def stored_properties_on(record)
properties = Set.new
begin
data_type.schema['properties'].keys.each do |key|
properties << key unless record[key].nil? && record.try(key).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 do_parse_xml
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def do_parse_xml(data_type, model, element, options, json_schema, record = nil, new_record = nil, enclosed_property = nil, container = nil, container_schema = nil)
Method difference
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def difference(other)
hash = {}
other.each do |other_key, other_value|
unless has_key?(other_key)
hash[other_key] = other_value
- 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 associated_ids
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def associated_ids(association, criteria)
associations =
begin
association.klass.get_associations
rescue
- 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 read_from_store
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def read_from_store(file, len)
cursor = file.cursor
return nil if cursor == file.length
chunk_size = file[:chunkSize]
current_chunk = cursor / chunk_size
- 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 create_authorization!
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_authorization!(auth_data = {})
auth_class = self.class.preferred_authorization_class(provider)
auth = auth_class.new(namespace: auth_data[:namespace], client_id: id, metadata: auth_data[:metadata])
auth.name = auth_data[:name] || "#{provider.name.to_title} #{auth_class.to_s.split('::').last.to_title} #{auth.id}"
if auth_class <= Setup::Oauth2Authorization
Method digest
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def digest
status = :accepted
json = {}
if request.body.length > MAX_SIZE
status = :bad_request
Method select_items
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_items
asc = true
if (order = @criteria.delete(:order))
order.strip!
asc = !order.match(/^-.*/)
Method select_items
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_items
asc = true
if (order = query_selector.delete(:order))
order.strip!
asc = !order.match(/^-.*/)
Method start
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start
Thread.new do
Cenit::Redis.new.subscribe(:hook) do |on|
on.subscribe do |channel, subscriptions|
puts "Redis Hook adapter subscribed to ##{channel} (#{subscriptions} subscriptions)"
Method push
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def push
response =
{
success: success_report = Hash.new { |h, k| h[k] = [] },
errors: broken_report = Hash.new { |h, k| h[k] = [] }