zeitnot/thinker

View on GitHub

Showing 3 of 3 total issues

Method compare has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def compare
    external_id = campaign.external_reference
    # Remote ad does not exist.
    return { remote_reference: external_id, remote_existence: false, discrepancies: [] } unless remote_ad

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

    def with_rescue
      retry_count = 0
      begin
        yield
      rescue StandardError => exception
Severity: Minor
Found in lib/ad_service_client.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 retry? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def retry?(exception, num_retries)
      return false if num_retries >= Thinker.max_network_retries

      # Retry on timeout-related problems (either on open or read).
      return true if exception.is_a?(Faraday::TimeoutError)
Severity: Minor
Found in lib/ad_service_client.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

Severity
Category
Status
Source
Language