Showing 45 of 81 total issues
Class AppRunner
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class AppRunner
extend Reflectable
include Reflectable
include Loggable
extend Loggable
Method as_json
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def as_json(options = nil) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
json = ActiveSupport::OrderedHash.new
if data && data.key?(MDM_KEY)
json['mdm'] = data[MDM_KEY]
- 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
Class Redis
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Redis
DEFAULT_MARK_OPTIONS = { persist: true }
def app(app_id)
Rpush::Client::Redis::App.find(app_id)
Class ActiveRecord
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ActiveRecord
include Reconnectable
DEFAULT_MARK_OPTIONS = { persist: true }
File add_rpush.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
class AddRpush < ActiveRecord::Migration[5.0]
def self.migrations
[CreateRapnsNotifications, CreateRapnsFeedback,
AddAlertIsJsonToRapnsNotifications, AddAppToRapns,
CreateRapnsApps, AddGcm, AddWpns, AddAdm, RenameRapnsToRpush,
Method humanize_json
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def humanize_json(node, str = '', depth = 0) # rubocop:disable Metrics/PerceivedComplexity
if node.is_a?(Hash)
node = node.sort_by { |_, v| [Array, Hash].include?(v.class) ? 1 : 0 }
node.each do |k, v|
if [Array, Hash].include?(v.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
Method up
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
add_column :rapns_notifications, :type, :string, null: true
add_column :rapns_apps, :type, :string, null: true
AddGcm::Rapns::Notification.update_all type: 'Rapns::Apns::Notification'
Method up
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
add_column :rapns_notifications, :type, :string, null: true
add_column :rapns_apps, :type, :string, null: true
AddGcm::Rapns::Notification.update_all type: 'Rapns::Apns::Notification'
Method copy_migration
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def copy_migration
if has_migration?('create_rapns_notifications')
add_rpush_migration('create_rapns_feedback')
add_rpush_migration('add_alert_is_json_to_rapns_notifications')
add_rpush_migration('add_app_to_rapns')
Method write
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def write(data)
connect unless @connected
reconnect_idle if idle_period_exceeded?
retry_count = 0
- 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 check_for_error
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_for_error
begin
# On Linux, select returns nil from a dropped connection.
# On OS X, Errno::EBADF is raised following a Errno::EADDRNOTAVAIL from the write call.
return unless @connection.select(SELECT_TIMEOUT)
- 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 process
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def process(failure_partitions = {}) # rubocop:disable Metrics/AbcSize
@successes = []
@failures = Failures.new
failure_partitions.each_key do |category|
failures[category] = []
- 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 start_handler
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.start_handler(read_io)
@thread = Thread.new do
while readable_io = IO.select([read_io]) # rubocop:disable Lint/AssignmentInCondition
signal = readable_io.first[0].gets.strip
- 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 down
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.down
AddGcm::Rapns::Notification.where(type: 'Rapns::Gcm::Notification').delete_all
remove_column :rapns_notifications, :type
remove_column :rapns_apps, :type
Method down
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.down
AddGcm::Rapns::Notification.where(type: 'Rapns::Gcm::Notification').delete_all
remove_column :rapns_notifications, :type
remove_column :rapns_apps, :type
Method start
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def start
return if Rpush.config.push
return unless @app.feedback_enabled
Rpush.logger.info("[#{@app.name}] Starting feedback receiver... ", true)
- 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 loop_instances
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def loop_instances(app)
(@loops || []).map do |cls, options|
next unless options.key?(:if) ? options[:if].call : true
cls.new(app)
end.compact
- 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 start
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def start
@started_at = Time.now
@thread = Thread.new do
loop do
- 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 included
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.included(base)
base.extend ClassMethods
base.instance_eval do
validates :device_token, presence: true
validates :badge, numericality: true, allow_nil: true
- 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_gcm_like_notification
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_gcm_like_notification(notification, attrs, data, registration_ids, deliver_after, app) # rubocop:disable Metrics/ParameterLists