calonso/ruby-push-notifications

View on GitHub

Showing 16 of 23 total issues

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

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

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

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

    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

      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

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|
          wns_result_for response[:code],
Severity: Minor
Found in lib/ruby-push-notifications/wns/wns_response.rb and 1 other location - About 40 mins to fix
lib/ruby-push-notifications/mpns/mpns_response.rb on lines 42..48

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