coding-chimp/onesignal

View on GitHub

Showing 673 of 673 total issues

File default_api.rb has 1493 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'cgi'

module OneSignal
  class DefaultApi
    attr_accessor :api_client
Severity: Major
Found in lib/onesignal/api/default_api.rb - About 3 days to fix

    Method initialize has a Cognitive Complexity of 154 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(attributes = {})
          if (!attributes.is_a?(Hash))
            fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::NotificationWithMeta` initialize method"
          end
    
    
    Severity: Minor
    Found in lib/onesignal/models/notification_with_meta.rb - About 3 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method initialize has a Cognitive Complexity of 142 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(attributes = {})
          if (!attributes.is_a?(Hash))
            fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::Notification` initialize method"
          end
    
    
    Severity: Minor
    Found in lib/onesignal/models/notification.rb - About 2 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method initialize has a Cognitive Complexity of 141 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(attributes = {})
          if (!attributes.is_a?(Hash))
            fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::BasicNotification` initialize method"
          end
    
    
    Severity: Minor
    Found in lib/onesignal/models/basic_notification.rb - About 2 days 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

    File notification_with_meta.rb has 1120 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'date'
    require 'time'
    
    module OneSignal
      class NotificationWithMeta
    Severity: Major
    Found in lib/onesignal/models/notification_with_meta.rb - About 2 days to fix

      File notification.rb has 1044 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'date'
      require 'time'
      
      module OneSignal
        class Notification
      Severity: Major
      Found in lib/onesignal/models/notification.rb - About 2 days to fix

        File basic_notification.rb has 1036 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'date'
        require 'time'
        
        module OneSignal
          class BasicNotification
        Severity: Major
        Found in lib/onesignal/models/basic_notification.rb - About 2 days to fix

          File basic_notification_all_of.rb has 892 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'date'
          require 'time'
          
          module OneSignal
            class BasicNotificationAllOf
          Severity: Major
          Found in lib/onesignal/models/basic_notification_all_of.rb - About 2 days to fix

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

                      included_segments == o.included_segments &&
                      excluded_segments == o.excluded_segments &&
                      include_player_ids == o.include_player_ids &&
                      include_external_user_ids == o.include_external_user_ids &&
                      include_email_tokens == o.include_email_tokens &&
            Severity: Major
            Found in lib/onesignal/models/notification.rb and 1 other location - About 2 days to fix
            lib/onesignal/models/notification_with_meta.rb on lines 1304..1411

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

            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

                      include_chrome_web_reg_ids == o.include_chrome_web_reg_ids &&
                      include_android_reg_ids == o.include_android_reg_ids &&
                      include_aliases == o.include_aliases &&
                      target_channel == o.target_channel &&
                      id == o.id &&
            Severity: Major
            Found in lib/onesignal/models/notification_with_meta.rb and 1 other location - About 2 days to fix
            lib/onesignal/models/notification.rb on lines 1200..1307

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

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

                def initialize(attributes = {})
                  if (!attributes.is_a?(Hash))
                    fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::BasicNotificationAllOf` initialize method"
                  end
            
            
            Severity: Minor
            Found in lib/onesignal/models/basic_notification_all_of.rb - About 2 days to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method initialize has 394 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def initialize(attributes = {})
                  if (!attributes.is_a?(Hash))
                    fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::NotificationWithMeta` initialize method"
                  end
            
            
            Severity: Major
            Found in lib/onesignal/models/notification_with_meta.rb - About 1 day to fix

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

              module OneSignal
                class NotificationSlice
                  attr_accessor :total_count
              
                  attr_accessor :offset
              Severity: Major
              Found in lib/onesignal/models/notification_slice.rb and 1 other location - About 1 day to fix
              lib/onesignal/models/player_slice.rb on lines 16..243

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

              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 OneSignal
                class PlayerSlice
                  attr_accessor :total_count
              
                  attr_accessor :offset
              Severity: Major
              Found in lib/onesignal/models/player_slice.rb and 1 other location - About 1 day to fix
              lib/onesignal/models/notification_slice.rb on lines 16..243

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

              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 OneSignal
                class CreateUserConflictResponseErrorsInner
                  attr_accessor :code
              
                  attr_accessor :title
              lib/onesignal/models/basic_notification_all_of_android_background_layout.rb on lines 16..236

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

              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 OneSignal
                # Channel: Push Notifications Platform: Android Allowing setting a background image for the notification. This is a JSON object containing the following keys. See our Background Image documentation for image sizes. 
                class BasicNotificationAllOfAndroidBackgroundLayout
                  # Asset file, android resource name, or URL to remote image.
                  attr_accessor :image
              lib/onesignal/models/create_user_conflict_response_errors_inner.rb on lines 16..232

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

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

                  def initialize(attributes = {})
                    if (!attributes.is_a?(Hash))
                      fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::Notification` initialize method"
                    end
              
              
              Severity: Major
              Found in lib/onesignal/models/notification.rb - About 1 day to fix

                Method initialize has 359 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def initialize(attributes = {})
                      if (!attributes.is_a?(Hash))
                        fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::BasicNotification` initialize method"
                      end
                
                
                Severity: Major
                Found in lib/onesignal/models/basic_notification.rb - About 1 day to fix

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

                  module OneSignal
                    class SegmentNotificationTarget
                      # The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] 
                      attr_accessor :included_segments
                  
                  
                  Severity: Major
                  Found in lib/onesignal/models/segment_notification_target.rb and 1 other location - About 1 day to fix
                  lib/onesignal/models/invalid_identifier_error.rb on lines 16..229

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

                  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 OneSignal
                    class InvalidIdentifierError
                      # Returned if using include_external_user_ids
                      attr_accessor :invalid_external_user_ids
                  
                  
                  Severity: Major
                  Found in lib/onesignal/models/invalid_identifier_error.rb and 1 other location - About 1 day to fix
                  lib/onesignal/models/segment_notification_target.rb on lines 16..229

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

                  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