inertia186/radiator

View on GitHub

Showing 67 of 1,476 total issues

Method error_match? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def error_match?(matches)
      matches = [matches].flatten
      
      any = matches.map do |match|
        case match
Severity: Minor
Found in lib/radiator/error_parser.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

Avoid too many return statements within this method.
Open

                return yield(response.result.values.first, response.error, response.id)
Severity: Major
Found in lib/radiator/api.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return response
    Severity: Major
    Found in lib/radiator/api.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return yield(response.result, response.error, response.id)
      Severity: Major
      Found in lib/radiator/api.rb - About 30 mins to fix

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

            def self.network_api(chain, api_name, options = {})
              api = case chain.to_sym
              when :steem then Steem::Api.clone(freeze: false) rescue Api.clone
              when :hive then Hive::Api.clone(freeze: false) rescue Api.clone
              else; raise ApiError, "Unsupported chain: #{chain}"
        Severity: Minor
        Found in lib/radiator/api.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 backoff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def backoff
              shutdown
              bump_failover if flappy? || !healthy?(uri)
              @backoff_at ||= Time.now.utc
              @backoff_sleep ||= 0.01
        Severity: Minor
        Found in lib/radiator/api.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 to_s has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def to_s
              if !!@cause
                JSON[error: @error, cause: @cause] rescue {error: @error, cause: @cause}.to_s
              else
                JSON[@error] rescue @error
        Severity: Minor
        Found in lib/radiator/base_error.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