deliveroo/routemaster-client

View on GitHub

Showing 3 of 9 total issues

Method call has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def call(env)
      catch :forward do
        throw :forward unless _intercept_endpoint?(env)
        return [401, {}, []] unless _has_auth?(env)
        return [403, {}, []] unless _valid_auth?(env)
Severity: Minor
Found in routemaster/receiver.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 _validate_all_options! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def _validate_all_options!
          _assert_present! url: url, uuid: uuid
          _assert_valid_url!(url)
          _assert_valid_uuid!(uuid)
          timeout ? _assert_valid_timeout!(timeout) : self.timeout = DEFAULT_TIMEOUT
Severity: Minor
Found in routemaster/client/configuration.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

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

      def _send_event(event, topic, callback, t: nil, async: false, data: nil)
        _assert_valid_url!(callback)
        _assert_valid_topic!(topic)
        _assert_valid_timestamp!(t) if t
        _assert_valid_data(data) if data
Severity: Minor
Found in routemaster/client.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