Showing 81 of 81 total issues

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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        def handle_access_token(response)
                          if response.code.to_i == 200
                            update_access_token(JSON.parse(response.body))
                            Rpush::Daemon.store.update_app(@notification.app)
                            log_info("ADM access token updated: token = #{@notification.app.access_token}, expires = #{@notification.app.access_token_expiration}")
                Severity: Minor
                Found in lib/rpush/daemon/adm/delivery.rb and 1 other location - About 35 mins to fix
                lib/rpush/daemon/wns/delivery.rb on lines 161..167

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 36.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  module Client
                    module ActiveModel
                      module Apns2
                        module App
                          def self.included(base)
                Severity: Minor
                Found in lib/rpush/client/active_model/apns2/app.rb and 1 other location - About 35 mins to fix
                lib/rpush/client/active_model/apns/app.rb on lines 2..15

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 36.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  module Client
                    module ActiveModel
                      module Apns
                        module App
                          def self.included(base)
                Severity: Minor
                Found in lib/rpush/client/active_model/apns/app.rb and 1 other location - About 35 mins to fix
                lib/rpush/client/active_model/apns2/app.rb on lines 2..15

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 36.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        def handle_access_token(response)
                          if response.code.to_i == 200
                            update_access_token(JSON.parse(response.body))
                            Rpush::Daemon.store.update_app(@notification.app)
                            log_info("WNS access token updated: token = #{@notification.app.access_token}, expires = #{@notification.app.access_token_expiration}")
                Severity: Minor
                Found in lib/rpush/daemon/wns/delivery.rb and 1 other location - About 35 mins to fix
                lib/rpush/daemon/adm/delivery.rb on lines 209..215

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 36.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    [:Apns, :Gcm, :Wpns, :Adm].each do |service|
                      update_type(Rpush200Updates::Rpush::App, "Rpush::#{service}::App", "Rpush::Client::ActiveRecord::#{service}::App")
                      update_type(Rpush200Updates::Rpush::Notification, "Rpush::#{service}::Notification", "Rpush::Client::ActiveRecord::#{service}::Notification")
                Severity: Minor
                Found in lib/generators/templates/rpush_2_0_0_updates.rb and 1 other location - About 30 mins to fix
                lib/generators/templates/rpush_2_0_0_updates.rb on lines 41..43

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    [:Apns, :Gcm, :Wpns, :Adm].each do |service|
                      update_type(Rpush200Updates::Rpush::App, "Rpush::Client::ActiveRecord::#{service}::App", "Rpush::#{service}::App")
                      update_type(Rpush200Updates::Rpush::Notification, "Rpush::Client::ActiveRecord::#{service}::Notification", "Rpush::#{service}::Notification")
                Severity: Minor
                Found in lib/generators/templates/rpush_2_0_0_updates.rb and 1 other location - About 30 mins to fix
                lib/generators/templates/rpush_2_0_0_updates.rb on lines 34..36

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                  def self.up
                    add_column :rapns_apps, :client_id, :string, null: true
                    add_column :rapns_apps, :client_secret, :string, null: true
                    add_column :rapns_apps, :access_token, :string, null: true
                    add_column :rapns_apps, :access_token_expiration, :datetime, null: true
                Severity: Minor
                Found in lib/generators/templates/add_adm.rb and 2 other locations - About 25 mins to fix
                lib/generators/templates/add_rpush.rb on lines 262..267
                lib/generators/templates/rpush_3_2_0_add_apns_p8.rb on lines 2..7

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 31.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language