killbill/killbill-client-ruby

View on GitHub

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

                      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

                            Method set_blocking_state has 10 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                  def set_blocking_state(state_name, service, is_block_change, is_block_entitlement, is_block_billing, requested_date = nil, user = nil, reason = nil, comment = nil, options = {})
                            Severity: Major
                            Found in lib/killbill_client/models/bundle.rb - About 1 hr to fix

                              Method create_entitlement_with_add_on has 10 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                    def create_entitlement_with_add_on(entitlements, entitlement_date, billing_date, migrated = false, rename_key_if_exists_and_unused = true, call_completion_sec = nil, user = nil, reason = nil, comment = nil, options = {})
                              Severity: Major
                              Found in lib/killbill_client/models/subscription.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language