coding-chimp/onesignal

View on GitHub

Showing 673 of 673 total issues

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

    def self.openapi_types
      {
        :'included_segments' => :'Array<String>',
        :'excluded_segments' => :'Array<String>',
        :'include_player_ids' => :'Array<String>',
Severity: Major
Found in lib/onesignal/models/basic_notification.rb and 1 other location - About 6 hrs to fix
lib/onesignal/models/basic_notification.rb on lines 349..456

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

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

File string_map.rb has 436 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'date'
require 'time'

module OneSignal
  class StringMap
Severity: Minor
Found in lib/onesignal/models/string_map.rb - About 6 hrs to fix

    Method initialize has a Cognitive Complexity of 41 (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::NotificationTarget` initialize method"
          end
    
    
    Severity: Minor
    Found in lib/onesignal/models/notification_target.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

    File app.rb has 416 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'date'
    require 'time'
    
    module OneSignal
      class App
    Severity: Minor
    Found in lib/onesignal/models/app.rb - About 6 hrs to fix

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

          def update_user_with_http_info(app_id, alias_label, alias_id, update_user_request, opts = {})
            if @api_client.config.debugging
              @api_client.config.logger.debug 'Calling API: DefaultApi.update_user ...'
            end
            # verify the required parameter 'app_id' is set
      Severity: Major
      Found in lib/onesignal/api/default_api.rb and 2 other locations - About 5 hrs to fix
      lib/onesignal/api/default_api.rb on lines 465..527
      lib/onesignal/api/default_api.rb on lines 2040..2102

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

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

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

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

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

      Refactorings

      Further Reading

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

          def create_subscription_with_http_info(app_id, alias_label, alias_id, create_subscription_request_body, opts = {})
            if @api_client.config.debugging
              @api_client.config.logger.debug 'Calling API: DefaultApi.create_subscription ...'
            end
            # verify the required parameter 'app_id' is set
      Severity: Major
      Found in lib/onesignal/api/default_api.rb and 2 other locations - About 5 hrs to fix
      lib/onesignal/api/default_api.rb on lines 2040..2102
      lib/onesignal/api/default_api.rb on lines 2662..2724

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

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

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

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

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

      Refactorings

      Further Reading

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

          def identify_user_by_alias_with_http_info(app_id, alias_label, alias_id, user_identity_request_body, opts = {})
            if @api_client.config.debugging
              @api_client.config.logger.debug 'Calling API: DefaultApi.identify_user_by_alias ...'
            end
            # verify the required parameter 'app_id' is set
      Severity: Major
      Found in lib/onesignal/api/default_api.rb and 2 other locations - About 5 hrs to fix
      lib/onesignal/api/default_api.rb on lines 465..527
      lib/onesignal/api/default_api.rb on lines 2662..2724

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

      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',
              :'value' => :'value',
              :'name' => :'name',
      Severity: Major
      Found in lib/onesignal/models/basic_notification_all_of.rb and 1 other location - About 5 hrs to fix
      lib/onesignal/models/basic_notification_all_of.rb on lines 412..505

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

      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',
              :'value' => :'Integer',
              :'name' => :'String',
      Severity: Major
      Found in lib/onesignal/models/basic_notification_all_of.rb and 1 other location - About 5 hrs to fix
      lib/onesignal/models/basic_notification_all_of.rb on lines 309..402

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

      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 37 (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::App` initialize method"
            end
      
      
      Severity: Minor
      Found in lib/onesignal/models/app.rb - About 5 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

      Method initialize has 138 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::StringMap` initialize method"
            end
      
      
      Severity: Major
      Found in lib/onesignal/models/string_map.rb - About 5 hrs to fix

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

            def transfer_subscription_with_http_info(app_id, subscription_id, transfer_subscription_request_body, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefaultApi.transfer_subscription ...'
              end
              # verify the required parameter 'app_id' is set
        Severity: Major
        Found in lib/onesignal/api/default_api.rb and 2 other locations - About 5 hrs to fix
        lib/onesignal/api/default_api.rb on lines 2122..2180
        lib/onesignal/api/default_api.rb on lines 2354..2412

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

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

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

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

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

        Refactorings

        Further Reading

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

            def update_live_activity_with_http_info(app_id, activity_id, update_live_activity_request, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefaultApi.update_live_activity ...'
              end
              # verify the required parameter 'app_id' is set
        Severity: Major
        Found in lib/onesignal/api/default_api.rb and 2 other locations - About 5 hrs to fix
        lib/onesignal/api/default_api.rb on lines 2122..2180
        lib/onesignal/api/default_api.rb on lines 2200..2258

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

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

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

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

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

        Refactorings

        Further Reading

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

            def identify_user_by_subscription_id_with_http_info(app_id, subscription_id, user_identity_request_body, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefaultApi.identify_user_by_subscription_id ...'
              end
              # verify the required parameter 'app_id' is set
        Severity: Major
        Found in lib/onesignal/api/default_api.rb and 2 other locations - About 5 hrs to fix
        lib/onesignal/api/default_api.rb on lines 2200..2258
        lib/onesignal/api/default_api.rb on lines 2354..2412

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

        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 35 (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::PlayerNotificationTarget` initialize method"
              end
        
        
        Severity: Minor
        Found in lib/onesignal/models/player_notification_target.rb - About 5 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

            def begin_live_activity_with_http_info(app_id, activity_id, begin_live_activity_request, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefaultApi.begin_live_activity ...'
              end
              # verify the required parameter 'app_id' is set
        Severity: Major
        Found in lib/onesignal/api/default_api.rb and 1 other location - About 5 hrs to fix
        lib/onesignal/api/default_api.rb on lines 2582..2640

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

        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 update_subscription_with_http_info(app_id, subscription_id, update_subscription_request_body, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefaultApi.update_subscription ...'
              end
              # verify the required parameter 'app_id' is set
        Severity: Major
        Found in lib/onesignal/api/default_api.rb and 1 other location - About 5 hrs to fix
        lib/onesignal/api/default_api.rb on lines 41..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 174.

        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 fetch_user_with_http_info(app_id, alias_label, alias_id, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefaultApi.fetch_user ...'
              end
              # verify the required parameter 'app_id' is set
        Severity: Major
        Found in lib/onesignal/api/default_api.rb and 1 other location - About 5 hrs to fix
        lib/onesignal/api/default_api.rb on lines 1332..1385

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

        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 fetch_user_identity_with_http_info(app_id, alias_label, alias_id, opts = {})
              if @api_client.config.debugging
                @api_client.config.logger.debug 'Calling API: DefaultApi.fetch_user_identity ...'
              end
              # verify the required parameter 'app_id' is set
        Severity: Major
        Found in lib/onesignal/api/default_api.rb and 1 other location - About 5 hrs to fix
        lib/onesignal/api/default_api.rb on lines 1259..1312

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

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

            def self.openapi_types
              {
                :'included_segments' => :'Array<String>',
                :'excluded_segments' => :'Array<String>',
                :'include_player_ids' => :'Array<String>',
        Severity: Major
        Found in lib/onesignal/models/notification_with_meta.rb - About 4 hrs to fix
          Severity
          Category
          Status
          Source
          Language