salesking/sepa_king

View on GitHub

Showing 10 of 16 total issues

Method build_transaction has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

    def build_transaction(builder, transaction)
      builder.DrctDbtTxInf do
        builder.PmtId do
          if transaction.instruction.present?
            builder.InstrId(transaction.instruction)
Severity: Minor
Found in lib/sepa_king/message/direct_debit.rb - About 1 day 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 has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    def build_transaction(builder, transaction)
      builder.CdtTrfTxInf do
        builder.PmtId do
          if transaction.instruction.present?
            builder.InstrId(transaction.instruction)
Severity: Minor
Found in lib/sepa_king/message/credit_transfer.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 build_transaction has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def build_transaction(builder, transaction)
      builder.DrctDbtTxInf do
        builder.PmtId do
          if transaction.instruction.present?
            builder.InstrId(transaction.instruction)
Severity: Major
Found in lib/sepa_king/message/direct_debit.rb - About 2 hrs to fix

    Method build_payment_informations has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_payment_informations(builder, schema_name)
          # Build a PmtInf block for every group of transactions
          grouped_transactions.each do |group, transactions|
            # All transactions with the same requested_date are placed into the same PmtInf block
            builder.PmtInf do
    Severity: Minor
    Found in lib/sepa_king/message/credit_transfer.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 build_transaction has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def build_transaction(builder, transaction)
          builder.CdtTrfTxInf do
            builder.PmtId do
              if transaction.instruction.present?
                builder.InstrId(transaction.instruction)
    Severity: Major
    Found in lib/sepa_king/message/credit_transfer.rb - About 2 hrs to fix

      Method build_payment_informations has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def build_payment_informations(builder, schema_name)
            # Build a PmtInf block for every group of transactions
            grouped_transactions.each do |group, transactions|
              builder.PmtInf do
                builder.PmtInfId(payment_information_identification(group))
      Severity: Major
      Found in lib/sepa_king/message/direct_debit.rb - About 2 hrs to fix

        Method build_payment_informations has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def build_payment_informations(builder, schema_name)
              # Build a PmtInf block for every group of transactions
              grouped_transactions.each do |group, transactions|
                # All transactions with the same requested_date are placed into the same PmtInf block
                builder.PmtInf do
        Severity: Minor
        Found in lib/sepa_king/message/credit_transfer.rb - About 1 hr to fix

          Method build_amendment_informations has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def build_amendment_informations(builder, transaction)
                builder.AmdmntInd(true)
                builder.AmdmntInfDtls do
                  if transaction.original_debtor_account
                    builder.OrgnlDbtrAcct do
          Severity: Minor
          Found in lib/sepa_king/message/direct_debit.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 build_amendment_informations has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def build_amendment_informations(builder, transaction)
                builder.AmdmntInd(true)
                builder.AmdmntInfDtls do
                  if transaction.original_debtor_account
                    builder.OrgnlDbtrAcct do
          Severity: Minor
          Found in lib/sepa_king/message/direct_debit.rb - About 1 hr to fix

            Method build_payment_informations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def build_payment_informations(builder, schema_name)
                  # Build a PmtInf block for every group of transactions
                  grouped_transactions.each do |group, transactions|
                    builder.PmtInf do
                      builder.PmtInfId(payment_information_identification(group))
            Severity: Minor
            Found in lib/sepa_king/message/direct_debit.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