expressly/expressly-plugin-sdk-ruby-core

View on GitHub
lib/expressly/api.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method execute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def execute(method_uri, http_verb, body = nil, limit = 4)
      raise 'too many HTTP redirects' if limit == 0

      uri = URI.parse("#{@endpoint}#{method_uri}")
      http = Net::HTTP.new(uri.host, uri.port)
Severity: Minor
Found in lib/expressly/api.rb - About 1 hr to fix

    Method execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute(method_uri, http_verb, body = nil, limit = 4)
          raise 'too many HTTP redirects' if limit == 0
    
          uri = URI.parse("#{@endpoint}#{method_uri}")
          http = Net::HTTP.new(uri.host, uri.port)
    Severity: Minor
    Found in lib/expressly/api.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

    (...) interpreted as grouped expression.
    Open

          raise (if is_json && !body['id'].nil? then ExpresslyError.new(body) else HttpError.new(response) end)
    Severity: Minor
    Found in lib/expressly/api.rb by rubocop

    Checks for space between the name of a called method and a left parenthesis.

    Example:

    # bad
    
    puts (x + y)

    Example:

    # good
    
    puts(x + y)

    Put one space between the method name and the first argument.
    Open

        attr_accessor   :id, :code, :description, :causes, :actions
    Severity: Minor
    Found in lib/expressly/api.rb by rubocop

    Checks that exactly one space is used between a method name and the first argument for method calls without parentheses.

    Alternatively, extra spaces can be added to align the argument with something on a preceding or following line, if the AllowForAlignment config parameter is true.

    Example:

    # bad
    something  x
    something   y, z
    something'hello'
    
    # good
    something x
    something y, z
    something 'hello'

    There are no issues that match your filters.

    Category
    Status