mattgreen/elevate

View on GitHub

Showing 5 of 5 total issues

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

    def initialize(method, url, options={})
      raise ArgumentError, "invalid HTTP method" unless METHODS.include? method.downcase
      raise ArgumentError, "invalid URL" unless url.start_with? "http"
      raise ArgumentError, "invalid body type; must be NSData" if options[:body] && ! options[:body].is_a?(NSData)

Severity: Minor
Found in lib/elevate/http/request.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 initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(method, url, options={})
      raise ArgumentError, "invalid HTTP method" unless METHODS.include? method.downcase
      raise ArgumentError, "invalid URL" unless url.start_with? "http"
      raise ArgumentError, "invalid body type; must be NSData" if options[:body] && ! options[:body].is_a?(NSData)

Severity: Minor
Found in lib/elevate/http/request.rb - About 1 hr to fix

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

        def self.encode_www_form(enum)
          enum.map do |k,v|
            if v.nil?
              encode_www_form_component(k)
            elsif v.respond_to?(:to_ary)
    Severity: Minor
    Found in lib/elevate/http/uri.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 method_missing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def method_missing(method, *args, &block)
          if method.to_s.start_with?("on_")
            raise ArgumentError, "wrong number of arguments" unless args.empty?
            raise ArgumentError, "block not supplied" unless block_given?
    
    
    Severity: Minor
    Found in lib/elevate/task_definition.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 issue has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def issue(method, path, body, options={}, &block)
    Severity: Minor
    Found in lib/elevate/http/http_client.rb - About 35 mins to fix
      Severity
      Category
      Status
      Source
      Language