Showing 45 of 81 total issues
Method start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def start
@stop = false
@thread = Thread.new(UNIXServer.open(Rpc.socket_path)) do |server|
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 initialize_client
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize_client
return if @client_initialized
raise ConfigurationError, 'Rpush.config.client is not set.' unless client
require "rpush/client/#{client}"
- 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 adapter_name
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def adapter_name
env = (defined?(Rails) && Rails.env) ? Rails.env : 'development'
if ::ActiveRecord::VERSION::MAJOR > 6
::ActiveRecord::Base.configurations.configs_for(env_name: env).first.configuration_hash[:adapter]
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 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
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
Method apns_feedback
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.apns_feedback
require 'rpush/daemon'
Rpush::Daemon.common_init
Rpush::Apns::App.all.each do |app|
- 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_notification
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_gcm_notification(attrs, data, registration_ids, deliver_after, app)
Method mark_failed
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def mark_failed(notification, code, description, time, opts = {})
Method create_adm_notification
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_adm_notification(attrs, data, registration_ids, deliver_after, app)
Method mark_failed
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def mark_failed(notification, code, description, time, opts = {})
Method create_adm_notification
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_adm_notification(attrs, data, registration_ids, deliver_after, app)
Method log
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def log(where, msg, inline = false, prefix = nil, io = STDOUT)
Method create_gcm_notification
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_gcm_notification(attrs, data, registration_ids, deliver_after, app)
Method log_foreground
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def log_foreground(io, formatted_msg, inline)
return unless Rpush.config.foreground_logging
return unless io == STDERR || Rpush.config.foreground
if inline
- 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 alert
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def alert
string_or_json = read_attribute(:alert)
if has_attribute?(:alert_is_json)
if alert_is_json?
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate(record)
return if record.vapid_keypair.blank?
keypair = record.vapid
%i[ subject public_key private_key ].each do |key|
unless keypair.key?(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
Method sound
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sound
string_or_json = read_attribute(:sound)
if has_attribute?(:sound_is_json)
if sound_is_json?
- 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 connect_socket
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def connect_socket
touch
check_certificate_expiration
tcp_socket = TCPSocket.new(@host, @port)
- 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 as_json
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def as_json(options = nil) # rubocop:disable Metrics/PerceivedComplexity
json = {
'registration_ids' => registration_ids,
'delay_while_idle' => delay_while_idle,
'data' => data
- 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 prepare_async_post
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prepare_async_post(notification)
response = {}
request = build_request(notification)
http_request = @client.prepare_request(:post, request[:path],
- 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"