coding-chimp/onesignal

View on GitHub

Showing 120 of 673 total issues

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

    def initialize(attributes = {})
      if (!attributes.is_a?(Hash))
        fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::UpdateLiveActivityRequest` initialize method"
      end

Severity: Major
Found in lib/onesignal/models/update_live_activity_request.rb and 3 other locations - About 2 hrs to fix
lib/onesignal/models/create_notification_success_response.rb on lines 61..87
lib/onesignal/models/filter.rb on lines 85..111
lib/onesignal/models/purchase.rb on lines 62..88

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

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 initialize(attributes = {})
      if (!attributes.is_a?(Hash))
        fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::PropertiesDeltas` initialize method"
      end

Severity: Major
Found in lib/onesignal/models/properties_deltas.rb and 1 other location - About 2 hrs to fix
lib/onesignal/models/segment.rb on lines 58..81

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

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 initialize(attributes = {})
      if (!attributes.is_a?(Hash))
        fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::Segment` initialize method"
      end

Severity: Major
Found in lib/onesignal/models/segment.rb and 1 other location - About 2 hrs to fix
lib/onesignal/models/properties_deltas.rb on lines 55..78

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

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 self.attribute_map
      {
        :'id' => :'id',
        :'name' => :'name',
        :'players' => :'players',
Severity: Major
Found in lib/onesignal/models/app.rb and 1 other location - About 1 hr to fix
lib/onesignal/models/app.rb on lines 175..210

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

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 self.openapi_types
      {
        :'id' => :'String',
        :'name' => :'String',
        :'players' => :'Integer',
Severity: Major
Found in lib/onesignal/models/app.rb and 1 other location - About 1 hr to fix
lib/onesignal/models/app.rb on lines 130..165

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

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 ==(o)
      return true if self.equal?(o)
      self.class == o.class &&
          remaining == o.remaining &&
          successful == o.successful &&
Severity: Major
Found in lib/onesignal/models/notification_with_meta_all_of.rb and 1 other location - About 1 hr to fix
lib/onesignal/models/properties_object.rb on lines 164..178

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

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 ==(o)
      return true if self.equal?(o)
      self.class == o.class &&
          tags == o.tags &&
          language == o.language &&
Severity: Major
Found in lib/onesignal/models/properties_object.rb and 1 other location - About 1 hr to fix
lib/onesignal/models/notification_with_meta_all_of.rb on lines 174..188

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

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 self.attribute_map
      {
        :'id' => :'id',
        :'invalid_identifier' => :'invalid_identifier',
        :'app_id' => :'app_id',
Severity: Major
Found in lib/onesignal/models/player.rb and 1 other location - About 1 hr to fix
lib/onesignal/models/player.rb on lines 137..165

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

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 self.openapi_types
      {
        :'id' => :'String',
        :'invalid_identifier' => :'Boolean',
        :'app_id' => :'String',
Severity: Major
Found in lib/onesignal/models/player.rb and 1 other location - About 1 hr to fix
lib/onesignal/models/player.rb on lines 99..127

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

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 self.openapi_types
      {
        :'id' => :'String',
        :'type' => :'String',
        :'token' => :'String',
Severity: Minor
Found in lib/onesignal/models/subscription_object.rb and 1 other location - About 40 mins to fix
lib/onesignal/models/subscription_object.rb on lines 75..93

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

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 ==(o)
      return true if self.equal?(o)
      self.class == o.class &&
          successful == o.successful &&
          failed == o.failed &&
Severity: Minor
Found in lib/onesignal/models/delivery_data.rb and 1 other location - About 40 mins to fix
lib/onesignal/models/filter_expressions.rb on lines 193..201

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

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 ==(o)
      return true if self.equal?(o)
      self.class == o.class &&
          field == o.field &&
          key == o.key &&
Severity: Minor
Found in lib/onesignal/models/filter_expressions.rb and 1 other location - About 40 mins to fix
lib/onesignal/models/delivery_data.rb on lines 122..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 38.

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 self.attribute_map
      {
        :'id' => :'id',
        :'type' => :'type',
        :'token' => :'token',
Severity: Minor
Found in lib/onesignal/models/subscription_object.rb and 1 other location - About 40 mins to fix
lib/onesignal/models/subscription_object.rb on lines 103..121

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

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

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

    def valid?
      target_channel_validator = EnumAttributeValidator.new('String', ["push", "email", "sms"])
      return false unless target_channel_validator.valid?(@target_channel)
      aggregation_validator = EnumAttributeValidator.new('String', ["sum", "count"])
      return false unless aggregation_validator.valid?(@aggregation)
Severity: Minor
Found in lib/onesignal/models/notification_with_meta.rb and 2 other locations - About 35 mins to fix
lib/onesignal/models/basic_notification.rb on lines 1156..1162
lib/onesignal/models/notification.rb on lines 1166..1172

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

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

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

    def valid?
      target_channel_validator = EnumAttributeValidator.new('String', ["push", "email", "sms"])
      return false unless target_channel_validator.valid?(@target_channel)
      aggregation_validator = EnumAttributeValidator.new('String', ["sum", "count"])
      return false unless aggregation_validator.valid?(@aggregation)
Severity: Minor
Found in lib/onesignal/models/basic_notification.rb and 2 other locations - About 35 mins to fix
lib/onesignal/models/notification.rb on lines 1166..1172
lib/onesignal/models/notification_with_meta.rb on lines 1260..1266

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

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

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

    def valid?
      target_channel_validator = EnumAttributeValidator.new('String', ["push", "email", "sms"])
      return false unless target_channel_validator.valid?(@target_channel)
      aggregation_validator = EnumAttributeValidator.new('String', ["sum", "count"])
      return false unless aggregation_validator.valid?(@aggregation)
Severity: Minor
Found in lib/onesignal/models/notification.rb and 2 other locations - About 35 mins to fix
lib/onesignal/models/basic_notification.rb on lines 1156..1162
lib/onesignal/models/notification_with_meta.rb on lines 1260..1266

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

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

Identical blocks of code found in 14 locations. Consider refactoring.
Open

    class EnumAttributeValidator
      attr_reader :datatype
      attr_reader :allowable_values

      def initialize(datatype, allowable_values)
Severity: Major
Found in lib/onesignal/models/subscription_object.rb and 13 other locations - About 35 mins to fix
lib/onesignal/models/app.rb on lines 107..126
lib/onesignal/models/basic_notification.rb on lines 326..345
lib/onesignal/models/basic_notification_all_of.rb on lines 286..305
lib/onesignal/models/filter.rb on lines 30..49
lib/onesignal/models/filter_expressions.rb on lines 33..52
lib/onesignal/models/get_notification_request_body.rb on lines 26..45
lib/onesignal/models/notification.rb on lines 329..348
lib/onesignal/models/notification_target.rb on lines 58..77
lib/onesignal/models/notification_with_meta.rb on lines 357..376
lib/onesignal/models/operator.rb on lines 21..40
lib/onesignal/models/outcome_data.rb on lines 24..43
lib/onesignal/models/player_notification_target.rb on lines 52..71
lib/onesignal/models/update_live_activity_request.rb on lines 28..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 34.

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

Identical blocks of code found in 14 locations. Consider refactoring.
Open

    class EnumAttributeValidator
      attr_reader :datatype
      attr_reader :allowable_values

      def initialize(datatype, allowable_values)
Severity: Major
Found in lib/onesignal/models/update_live_activity_request.rb and 13 other locations - About 35 mins to fix
lib/onesignal/models/app.rb on lines 107..126
lib/onesignal/models/basic_notification.rb on lines 326..345
lib/onesignal/models/basic_notification_all_of.rb on lines 286..305
lib/onesignal/models/filter.rb on lines 30..49
lib/onesignal/models/filter_expressions.rb on lines 33..52
lib/onesignal/models/get_notification_request_body.rb on lines 26..45
lib/onesignal/models/notification.rb on lines 329..348
lib/onesignal/models/notification_target.rb on lines 58..77
lib/onesignal/models/notification_with_meta.rb on lines 357..376
lib/onesignal/models/operator.rb on lines 21..40
lib/onesignal/models/outcome_data.rb on lines 24..43
lib/onesignal/models/player_notification_target.rb on lines 52..71
lib/onesignal/models/subscription_object.rb on lines 52..71

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

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

Identical blocks of code found in 14 locations. Consider refactoring.
Open

    class EnumAttributeValidator
      attr_reader :datatype
      attr_reader :allowable_values

      def initialize(datatype, allowable_values)
Severity: Major
Found in lib/onesignal/models/notification_target.rb and 13 other locations - About 35 mins to fix
lib/onesignal/models/app.rb on lines 107..126
lib/onesignal/models/basic_notification.rb on lines 326..345
lib/onesignal/models/basic_notification_all_of.rb on lines 286..305
lib/onesignal/models/filter.rb on lines 30..49
lib/onesignal/models/filter_expressions.rb on lines 33..52
lib/onesignal/models/get_notification_request_body.rb on lines 26..45
lib/onesignal/models/notification.rb on lines 329..348
lib/onesignal/models/notification_with_meta.rb on lines 357..376
lib/onesignal/models/operator.rb on lines 21..40
lib/onesignal/models/outcome_data.rb on lines 24..43
lib/onesignal/models/player_notification_target.rb on lines 52..71
lib/onesignal/models/subscription_object.rb on lines 52..71
lib/onesignal/models/update_live_activity_request.rb on lines 28..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 34.

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

Identical blocks of code found in 14 locations. Consider refactoring.
Open

    class EnumAttributeValidator
      attr_reader :datatype
      attr_reader :allowable_values

      def initialize(datatype, allowable_values)
Severity: Major
Found in lib/onesignal/models/notification.rb and 13 other locations - About 35 mins to fix
lib/onesignal/models/app.rb on lines 107..126
lib/onesignal/models/basic_notification.rb on lines 326..345
lib/onesignal/models/basic_notification_all_of.rb on lines 286..305
lib/onesignal/models/filter.rb on lines 30..49
lib/onesignal/models/filter_expressions.rb on lines 33..52
lib/onesignal/models/get_notification_request_body.rb on lines 26..45
lib/onesignal/models/notification_target.rb on lines 58..77
lib/onesignal/models/notification_with_meta.rb on lines 357..376
lib/onesignal/models/operator.rb on lines 21..40
lib/onesignal/models/outcome_data.rb on lines 24..43
lib/onesignal/models/player_notification_target.rb on lines 52..71
lib/onesignal/models/subscription_object.rb on lines 52..71
lib/onesignal/models/update_live_activity_request.rb on lines 28..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 34.

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