moneytrackio/tezos_client

View on GitHub

Showing 13 of 15 total issues

Class OperationMgr has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class OperationMgr
    include Crypto
    using CurrencyUtils

    attr_accessor :rpc_interface,
Severity: Minor
Found in lib/tezos_client/operation_mgr.rb - About 3 hrs to fix

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

    class TezosClient
      module Crypto
        using StringUtils
    
        PREFIXES = {
    Severity: Minor
    Found in lib/tezos_client/crypto.rb - About 2 hrs to fix

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

        def monitor_operation(operation_id, timeout: 120)
          including_block = nil
      
          monitoring_thread = rpc_interface.monitor_block do |block_header|
            log "recently received block: #{block_header.pretty_inspect}"
      Severity: Minor
      Found in lib/tezos_client.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 create_logger has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def create_logger(param)
              return unless param
      
              if param.is_a? String
                if param == "stdout"
      Severity: Minor
      Found in lib/tezos_client/logger.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 treat_char has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def treat_char(char, is_last_char)
              return if treat_escape(char)
      
              unless popen || sopen
                if is_last_char || char == " "
      Severity: Minor
      Found in lib/tezos_client/encode_utils.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 treat_val has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def treat_val
              unless @val.empty?
                if @val == @val.to_i.to_s
                  if !ret[:prim]
                    @ret = { "int" => @val }
      Severity: Minor
      Found in lib/tezos_client/encode_utils.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 tezos_contents_log_filter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def tezos_contents_log_filter(content)
            if content.is_a? Array
              content.map { |el| tezos_contents_log_filter(el) }
            elsif content.is_a? Hash
              content.reduce({}) do |h, (k, v)|
      Severity: Minor
      Found in lib/tezos_client/logger.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 treat_parenthesis has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def treat_parenthesis(char)
              case char
              when "("
                @val += char if @popen
                @popen = true
      Severity: Minor
      Found in lib/tezos_client/encode_utils.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 decode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def decode
                if data.key?(:bytes)
                  if data[:bytes].start_with?("0000")
                    encode_tz(:tz1, data[:bytes][4..-1])
                  elsif data[:bytes].start_with?("0001")
      Severity: Minor
      Found in lib/tezos_client/tools/convert_to_hash/address.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 treat_double_quote has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def treat_double_quote(char)
              return false unless char == '"'
      
              if @sopen
                @sopen = false
      Severity: Minor
      Found in lib/tezos_client/encode_utils.rb - About 35 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 format_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def format_response(response)
                if response.is_a? Array
                  response.map do |el|
                    (el.is_a? Hash) ? el.with_indifferent_access : el
                  end
      Severity: Minor
      Found in lib/tezos_client/rpc_interface/request_manager.rb - About 35 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 block_include_operation? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def block_include_operation?(operation_id, block_id)
          retries ||= 0
      
          operations = rpc_interface.get("chains/main/blocks/#{block_id}/operation_hashes")
          operations.flatten.include? operation_id
      Severity: Minor
      Found in lib/tezos_client.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

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

                def data_n(n)
                  if data.is_a? ::Array
                    is_last_arg = n == (args_count - 1)
                    # Handle the case when last arg is i Pair, which arguments are the last elements of the data
                    if is_last_arg && data.size > args_count
      Severity: Minor
      Found in lib/tezos_client/tools/hash_to_micheline/pair.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