avdi/leadlight

View on GitHub

Showing 5 of 5 total issues

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

    def initialize(url = nil, options = {})
      if url.is_a?(Hash)
        options = url
        url     = options[:url]
      end
Severity: Minor
Found in lib/leadlight/lib_ext/faraday/connection.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(service, connection, url, method, body=nil, options={})
Severity: Minor
Found in lib/leadlight/request.rb - About 45 mins to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(service, href, rel=nil, title=rel, options={})
    Severity: Minor
    Found in lib/leadlight/link.rb - About 35 mins to fix

      Method perform_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def perform_request(url, http_method, body=nil, options={}, &representation_handler)
      Severity: Minor
      Found in lib/leadlight/service.rb - About 35 mins to fix

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

            def expand(*args)
              return self if args.empty?
              mapping = args.last.is_a?(Hash) ? args.pop : {}
              mapping = mapping.inject({}) { |result, (k,v)| result.merge!(k.to_s => v) }
              mapping = href_template.variables.inject(mapping) do |mapping, var|
        Severity: Minor
        Found in lib/leadlight/link_template.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