springboardretail/springboard-client-ruby

View on GitHub

Showing 3 of 3 total issues

Class Client has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Client
    ##
    # Default number of records per page when iterating over collection resources
    DEFAULT_PER_PAGE = 20

Severity: Minor
Found in lib/heartland/client.rb - About 2 hrs to fix

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

    def make_request(method, uri, headers=false, body=false)
      response = connection.__send__( method, prepare_uri(uri)) do |request|
        request.headers = headers unless headers === false
        request.headers['Cookie'] = session_cookie if session_cookie

Severity: Minor
Found in lib/heartland/client.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 filter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def filter(new_filters)
        new_filters = JSON.parse(new_filters) if new_filters.is_a?(String)
        if filters = query['_filter']
          filters = JSON.parse(filters)
          filters = [filters] unless filters.is_a?(Array)
Severity: Minor
Found in lib/heartland/client/collection.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