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
Severity: Minor
Found in lib/rpush/daemon/rpc/server.rb - About 45 mins to fix

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}"

Severity: Minor
Found in lib/rpush/configuration.rb - About 45 mins to fix

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
Severity: Minor
Found in lib/rpush/daemon/store/active_record.rb - About 45 mins to fix

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
Severity: Minor
Found in lib/rpush/daemon/store/redis.rb - About 45 mins to fix

    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
    Severity: Minor
    Found in lib/rpush/daemon/store/active_record.rb - About 45 mins to fix

      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|
      Severity: Minor
      Found in lib/rpush/apns_feedback.rb - About 45 mins to fix

      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)
      Severity: Minor
      Found in lib/rpush/daemon/store/redis.rb - About 35 mins to fix

        Method mark_failed has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def mark_failed(notification, code, description, time, opts = {})
        Severity: Minor
        Found in lib/rpush/daemon/store/active_record.rb - About 35 mins to fix

          Method create_adm_notification has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def create_adm_notification(attrs, data, registration_ids, deliver_after, app)
          Severity: Minor
          Found in lib/rpush/daemon/store/active_record.rb - About 35 mins to fix

            Method mark_failed has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def mark_failed(notification, code, description, time, opts = {})
            Severity: Minor
            Found in lib/rpush/daemon/store/redis.rb - About 35 mins to fix

              Method create_adm_notification has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      def create_adm_notification(attrs, data, registration_ids, deliver_after, app)
              Severity: Minor
              Found in lib/rpush/daemon/store/redis.rb - About 35 mins to fix

                Method log has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def log(where, msg, inline = false, prefix = nil, io = STDOUT)
                Severity: Minor
                Found in lib/rpush/logger.rb - About 35 mins to fix

                  Method create_gcm_notification has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          def create_gcm_notification(attrs, data, registration_ids, deliver_after, app)
                  Severity: Minor
                  Found in lib/rpush/daemon/store/active_record.rb - About 35 mins to fix

                    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
                    Severity: Minor
                    Found in lib/rpush/logger.rb - About 35 mins to fix

                    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?

                    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)
                    Severity: Minor
                    Found in lib/rpush/client/active_model/webpush/app.rb - About 35 mins to fix

                    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?

                    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)
                    Severity: Minor
                    Found in lib/rpush/daemon/tcp_connection.rb - About 35 mins to fix

                    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
                    Severity: Minor
                    Found in lib/rpush/client/active_model/gcm/notification.rb - About 35 mins to fix

                    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],
                    Severity: Minor
                    Found in lib/rpush/daemon/apnsp8/delivery.rb - About 25 mins to fix

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language