KentaaNL/buckaruby

View on GitHub

Showing 8 of 12 total issues

Class Gateway has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Gateway
    extend Forwardable

    def_delegators :config, :logger

Severity: Minor
Found in lib/buckaruby/gateway.rb - About 2 hrs to fix

    Method parse has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def parse(brq_transaction_type, brq_recurring)
          if brq_transaction_type && !brq_transaction_type.empty?
            case brq_transaction_type
            when 'C021', 'V021',                                  # iDEAL
                 'C002', 'C004', 'C005',                          # (SEPA) Direct Debit
    Severity: Major
    Found in lib/buckaruby/transaction_type.rb - About 2 hrs to fix

      Method build_transaction_request_params has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def build_transaction_request_params(options)
            params = {}
      
            case options[:payment_method]
            when PaymentMethod::IDEAL
      Severity: Minor
      Found in lib/buckaruby/request.rb - About 1 hr to fix

        Method map_fields has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def map_fields(params, prefix)
              results = []
              index = 1
        
              loop do
        Severity: Minor
        Found in lib/buckaruby/field_mapper.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 map_fields has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def map_fields(params, prefix)
              results = []
              index = 1
        
              loop do
        Severity: Minor
        Found in lib/buckaruby/field_mapper.rb - About 1 hr to fix

          Method parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def parse(brq_transaction_type, brq_recurring)
                if brq_transaction_type && !brq_transaction_type.empty?
                  case brq_transaction_type
                  when 'C021', 'V021',                                  # iDEAL
                       'C002', 'C004', 'C005',                          # (SEPA) Direct Debit
          Severity: Minor
          Found in lib/buckaruby/transaction_type.rb - About 55 mins 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 build_transaction_request_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def build_transaction_request_params(options)
                params = {}
          
                case options[:payment_method]
                when PaymentMethod::IDEAL
          Severity: Minor
          Found in lib/buckaruby/request.rb - About 45 mins 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 post_buckaroo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def post_buckaroo(uri, params)
                http = Net::HTTP.new(uri.host, uri.port)
                if uri.scheme == 'https'
                  http.use_ssl = true
                  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
          Severity: Minor
          Found in lib/buckaruby/request.rb - About 25 mins 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

          Severity
          Category
          Status
          Source
          Language