killbill/killbill-client-ruby

View on GitHub

Showing 199 of 199 total issues

Class Account has 47 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Account < AccountAttributes

      KILLBILL_API_ACCOUNTS_PREFIX = "#{KILLBILL_API_PREFIX}/accounts"

      include KillBillClient::Model::TagHelper
Severity: Minor
Found in lib/killbill_client/models/account.rb - About 6 hrs to fix

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

            def request(method, relative_uri, options = {})
              head = headers.dup
              head.update options[:head] if options[:head]
              head.delete_if { |_, value| value.nil? }
    
    
    Severity: Minor
    Found in lib/killbill_client/api/net_http_adapter.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

    Method request has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def request(method, relative_uri, options = {})
              head = headers.dup
              head.update options[:head] if options[:head]
              head.delete_if { |_, value| value.nil? }
    
    
    Severity: Major
    Found in lib/killbill_client/api/net_http_adapter.rb - About 4 hrs to fix

      File account.rb has 340 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module KillBillClient
        module Model
          class Account < AccountAttributes
      
            KILLBILL_API_ACCOUNTS_PREFIX = "#{KILLBILL_API_PREFIX}/accounts"
      Severity: Minor
      Found in lib/killbill_client/models/account.rb - About 4 hrs to fix

        File invoice.rb has 331 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module KillBillClient
          module Model
            class Invoice < InvoiceAttributes
        
              include KillBillClient::Model::CustomFieldHelper
        Severity: Minor
        Found in lib/killbill_client/models/invoice.rb - About 3 hrs to fix

          Method instantiate_record_from_json has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                  def instantiate_record_from_json(resource_class, data)
                    record = resource_class.send :new
          
                    kb_ancestors = resource_class.ancestors.select { |ancestor| !@@attribute_names[ancestor.name].nil? }
                    data.each do |name, value|
          Severity: Minor
          Found in lib/killbill_client/models/resource.rb - About 3 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

          Class Invoice has 26 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class Invoice < InvoiceAttributes
          
                include KillBillClient::Model::CustomFieldHelper
                include KillBillClient::Model::TagHelper
                include KillBillClient::Model::AuditLogWithHistoryHelper
          Severity: Minor
          Found in lib/killbill_client/models/invoice.rb - About 3 hrs to fix

            Method create_proc_condition_for_wait_for_plugin_command_completion has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                    def create_proc_condition_for_wait_for_plugin_command_completion(options, plugin_key, plugin_version, state=nil, is_negate=false)
                      proc_condition = Proc.new {
                        node_infos = KillBillClient::Model::NodesInfo.nodes_info(options)
            
                        res = true
            Severity: Minor
            Found in lib/killbill_client/models/nodes_info.rb - About 2 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 has_custom_fields has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def has_custom_fields(url_prefix, id_alias)
                      define_method('custom_fields') do |*args|
            
                        audit = args[0] || 'NONE'
                        options = args[1] || {}
            Severity: Major
            Found in lib/killbill_client/models/helpers/custom_field_helper.rb - About 2 hrs to fix

              Class Transaction has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Transaction < PaymentTransactionAttributes
              
                    include KillBillClient::Model::CustomFieldHelper
                    include KillBillClient::Model::AuditLogWithHistoryHelper
                    include KillBillClient::Model::TagHelper
              Severity: Minor
              Found in lib/killbill_client/models/transaction.rb - About 2 hrs to fix

                Class Tenant has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class Tenant < TenantAttributes
                      KILLBILL_API_TENANTS_PREFIX = "#{KILLBILL_API_PREFIX}/tenants"
                      KILLBILL_API_TENANTS_NOTIFICATION = "#{KILLBILL_API_TENANTS_PREFIX}/registerNotificationCallback"
                      KILLBILL_API_TENANTS_SYSTEM_CONFIGURATION = "#{KILLBILL_API_TENANTS_PREFIX}/uploadPerTenantConfig"
                      KILLBILL_API_TENANTS_PLUGIN_PAYMENT_STATE_MACHINE = "#{KILLBILL_API_TENANTS_PREFIX}/uploadPluginPaymentStateMachineConfig"
                Severity: Minor
                Found in lib/killbill_client/models/tenant.rb - About 2 hrs to fix

                  Class Resource has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class Resource
                  
                        attr_reader :clazz,
                                    :etag,
                                    :session_id,
                  Severity: Minor
                  Found in lib/killbill_client/models/resource.rb - About 2 hrs to fix

                    Method has_tags has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def has_tags(url_prefix, id_alias)
                              define_method('tags') do |*args|
                    
                                included_deleted = args[0] || false
                                audit = args[1] || 'NONE'
                    Severity: Minor
                    Found in lib/killbill_client/models/helpers/tag_helper.rb - About 1 hr to fix

                      Method from_response has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def from_response(resource_class, response)
                                case response['Content-Type']
                                  when nil
                                    response.body
                                  when %r{application/pdf}
                      Severity: Minor
                      Found in lib/killbill_client/models/resource.rb - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                                define_method('add_custom_field') do |*args|
                      
                                  custom_fields = args[0]
                                  user = args[1]
                                  reason = args[2]
                      Severity: Major
                      Found in lib/killbill_client/models/helpers/custom_field_helper.rb and 1 other location - About 1 hr to fix
                      lib/killbill_client/models/helpers/custom_field_helper.rb on lines 41..59

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

                      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

                                define_method('modify_custom_field') do |*args|
                      
                                  custom_fields = args[0]
                                  user = args[1]
                                  reason = args[2]
                      Severity: Major
                      Found in lib/killbill_client/models/helpers/custom_field_helper.rb and 1 other location - About 1 hr to fix
                      lib/killbill_client/models/helpers/custom_field_helper.rb on lines 20..38

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

                      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 trigger_node_command_wait_for_plugin_command_completion has 12 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              def trigger_node_command_wait_for_plugin_command_completion(node_command_type, plugin_key, plugin_version, plugin_props, local_node_only, user, reason, comment, options, timeout_sec, sleep_sec, &proc_condition)
                      Severity: Major
                      Found in lib/killbill_client/models/nodes_info.rb - About 1 hr to fix

                        Method from_response has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                def from_response(resource_class, response)
                                  case response['Content-Type']
                                    when nil
                                      response.body
                                    when %r{application/pdf}
                        Severity: Minor
                        Found in lib/killbill_client/models/resource.rb - About 1 hr to fix

                          Method build_uri has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  def build_uri(relative_uri, options)
                                    # Need to encode in case of spaces (e.g. /1.0/kb/security/users/Mad Max/roles)
                                    encoded_relative_uri = URI::DEFAULT_PARSER.escape(relative_uri)
                                    if URI(encoded_relative_uri).scheme.nil?
                                      uri = (options[:base_uri] || KillBillClient::API.base_uri)
                          Severity: Minor
                          Found in lib/killbill_client/api/net_http_adapter.rb - About 1 hr to fix

                          Cognitive Complexity

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

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

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

                          Further reading

                          Method change_plan_dry_run has 11 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  def change_plan_dry_run(account_id, bundle_id, subscription_id, target_date, product_name, product_category, billing_period, price_list_name,
                                                          effective_date, billing_policy, options = {})
                          Severity: Major
                          Found in lib/killbill_client/models/invoice.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language