calonso/ruby-push-notifications

View on GitHub

Showing 23 of 23 total issues

Method as_mpns_xml has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

      def as_mpns_xml
        xml = Builder::XmlMarkup.new
        xml.instruct!
        if data[:type] != :raw
          xml.tag!('wp:Notification', 'xmlns:wp' => 'WPNotification') do
Severity: Minor
Found in lib/ruby-push-notifications/mpns/mpns_notification.rb - About 6 hrs 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

  module GCM

    # This class encapsulates a response received from the GCM service
    # and helps parsing and understanding the received meesages/codes.
    #
Severity: Major
Found in lib/ruby-push-notifications/gcm/gcm_response.rb and 1 other location - About 3 hrs to fix
lib/ruby-push-notifications/fcm/fcm_response.rb on lines 4..86

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 124.

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 FCM

    # This class encapsulates a response received from the FCM service
    # and helps parsing and understanding the received meesages/codes.
    #
Severity: Major
Found in lib/ruby-push-notifications/fcm/fcm_response.rb and 1 other location - About 3 hrs to fix
lib/ruby-push-notifications/gcm/gcm_response.rb on lines 3..85

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 124.

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 RubyPushNotifications
  module FCM
    # Encapsulates a connection to the FCM service
    # Responsible for final connection with the service.
    #
Severity: Major
Found in lib/ruby-push-notifications/fcm/fcm_connection.rb and 1 other location - About 1 hr to fix
lib/ruby-push-notifications/gcm/gcm_connection.rb on lines 4..50

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 76.

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 RubyPushNotifications
  module GCM
    # Encapsulates a connection to the GCM service
    # Responsible for final connection with the service.
    #
Severity: Major
Found in lib/ruby-push-notifications/gcm/gcm_connection.rb and 1 other location - About 1 hr to fix
lib/ruby-push-notifications/fcm/fcm_connection.rb on lines 6..53

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 76.

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 push has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def push(notifications)
        conn = APNSConnection.open @certificate, @sandbox, @pass, @options

        binaries = notifications.each_with_object([]) do |notif, binaries|
          notif.each_message(binaries.count) do |msg|
Severity: Minor
Found in lib/ruby-push-notifications/apns/apns_pusher.rb - About 1 hr 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 push has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def push(notifications)
        conn = APNSConnection.open @certificate, @sandbox, @pass, @options

        binaries = notifications.each_with_object([]) do |notif, binaries|
          notif.each_message(binaries.count) do |msg|
Severity: Minor
Found in lib/ruby-push-notifications/apns/apns_pusher.rb - About 1 hr to fix

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

      module FCM
        # Class that encapsulates the result of a single sent notification to a single
        # Registration ID
        # (https://developer.android.com/google/fcm/server-ref.html#table4)
        # @author Carlos Alonso
    Severity: Major
    Found in lib/ruby-push-notifications/fcm/fcm_result.rb and 1 other location - About 1 hr to fix
    lib/ruby-push-notifications/gcm/gcm_result.rb on lines 3..49

    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 54.

    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 GCM
        # Class that encapsulates the result of a single sent notification to a single
        # Registration ID
        # (https://developer.android.com/google/gcm/server-ref.html#table4)
        # @author Carlos Alonso
    Severity: Major
    Found in lib/ruby-push-notifications/gcm/gcm_result.rb and 1 other location - About 1 hr to fix
    lib/ruby-push-notifications/fcm/fcm_result.rb on lines 4..50

    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 54.

    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 as_wns_xml has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def as_wns_xml
            xml = Builder::XmlMarkup.new
            xml.instruct!
            if data[:type] != :raw
              case data[:type]
    Severity: Minor
    Found in lib/ruby-push-notifications/wns/wns_notification.rb - About 1 hr to fix

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

          class MPNSInvalidError < MPNSResult
            # @return [String]. The status of the notification received
            # by the Microsoft Push Notification Service.
            attr_accessor :notification_status
      
      
      Severity: Major
      Found in lib/ruby-push-notifications/mpns/mpns_result.rb and 5 other locations - About 1 hr to fix
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 24..48
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 108..132
      lib/ruby-push-notifications/wns/wns_result.rb on lines 22..46
      lib/ruby-push-notifications/wns/wns_result.rb on lines 75..99
      lib/ruby-push-notifications/wns/wns_result.rb on lines 106..130

      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 52.

      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 6 locations. Consider refactoring.
      Open

          class WNSResultOK < WNSResult
            # @return [String]. The status of the notification received
            # by the Windows Notification Service.
            attr_accessor :notification_status
      
      
      Severity: Major
      Found in lib/ruby-push-notifications/wns/wns_result.rb and 5 other locations - About 1 hr to fix
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 24..48
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 77..101
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 108..132
      lib/ruby-push-notifications/wns/wns_result.rb on lines 75..99
      lib/ruby-push-notifications/wns/wns_result.rb on lines 106..130

      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 52.

      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 6 locations. Consider refactoring.
      Open

          class WNSLimitError < WNSResult
            # @return [String]. The status of the notification received
            # by the Windows Notification Service.
            attr_accessor :notification_status
      
      
      Severity: Major
      Found in lib/ruby-push-notifications/wns/wns_result.rb and 5 other locations - About 1 hr to fix
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 24..48
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 77..101
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 108..132
      lib/ruby-push-notifications/wns/wns_result.rb on lines 22..46
      lib/ruby-push-notifications/wns/wns_result.rb on lines 75..99

      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 52.

      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 6 locations. Consider refactoring.
      Open

          class MPNSResultOK < MPNSResult
            # @return [String]. The status of the notification received
            # by the Microsoft Push Notification Service.
            attr_accessor :notification_status
      
      
      Severity: Major
      Found in lib/ruby-push-notifications/mpns/mpns_result.rb and 5 other locations - About 1 hr to fix
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 77..101
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 108..132
      lib/ruby-push-notifications/wns/wns_result.rb on lines 22..46
      lib/ruby-push-notifications/wns/wns_result.rb on lines 75..99
      lib/ruby-push-notifications/wns/wns_result.rb on lines 106..130

      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 52.

      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 6 locations. Consider refactoring.
      Open

          class WNSInvalidError < WNSResult
            # @return [String]. The status of the notification received
            # by the Windows Notification Service.
            attr_accessor :notification_status
      
      
      Severity: Major
      Found in lib/ruby-push-notifications/wns/wns_result.rb and 5 other locations - About 1 hr to fix
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 24..48
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 77..101
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 108..132
      lib/ruby-push-notifications/wns/wns_result.rb on lines 22..46
      lib/ruby-push-notifications/wns/wns_result.rb on lines 106..130

      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 52.

      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 6 locations. Consider refactoring.
      Open

          class MPNSLimitError < MPNSResult
            # @return [String]. The status of the notification received
            # by the Microsoft Push Notification Service.
            attr_accessor :notification_status
      
      
      Severity: Major
      Found in lib/ruby-push-notifications/mpns/mpns_result.rb and 5 other locations - About 1 hr to fix
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 24..48
      lib/ruby-push-notifications/mpns/mpns_result.rb on lines 77..101
      lib/ruby-push-notifications/wns/wns_result.rb on lines 22..46
      lib/ruby-push-notifications/wns/wns_result.rb on lines 75..99
      lib/ruby-push-notifications/wns/wns_result.rb on lines 106..130

      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 52.

      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 as_mpns_xml has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def as_mpns_xml
              xml = Builder::XmlMarkup.new
              xml.instruct!
              if data[:type] != :raw
                xml.tag!('wp:Notification', 'xmlns:wp' => 'WPNotification') do
      Severity: Minor
      Found in lib/ruby-push-notifications/mpns/mpns_notification.rb - About 1 hr to fix

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

            class MPNSPreConditionError < MPNSResult
              # @return [String]. The status of the notification received
              # by the Microsoft Push Notification Service.
              attr_accessor :notification_status
        
        
        Severity: Minor
        Found in lib/ruby-push-notifications/mpns/mpns_result.rb and 1 other location - About 45 mins to fix
        lib/ruby-push-notifications/wns/wns_result.rb on lines 134..153

        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 41.

        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

            class WNSPreConditionError < WNSResult
              # @return [String]. The status of the notification received
              # by the Windows Notification Service.
              attr_accessor :notification_status
        
        
        Severity: Minor
        Found in lib/ruby-push-notifications/wns/wns_result.rb and 1 other location - About 45 mins to fix
        lib/ruby-push-notifications/mpns/mpns_result.rb on lines 136..155

        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 41.

        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 parse_response(responses)
                @success = responses.count { |response| response[:code] == 200 }
                @failed = responses.count { |response| response[:code] != 200 }
                @results = responses.map do |response|
                  mpns_result_for response[:code],
        Severity: Minor
        Found in lib/ruby-push-notifications/mpns/mpns_response.rb and 1 other location - About 40 mins to fix
        lib/ruby-push-notifications/wns/wns_response.rb on lines 41..47

        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 37.

        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