joshmn/caffeinate

View on GitHub

Showing 3 of 8 total issues

Method periodical has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def periodical(action_name, every:, start: -> { ::Caffeinate.config.time_now }, **options, &block)
          options[:start] = start
          options[:every] = every
          periodical_drip(action_name, **options, &block)

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

    def call
      if periodical?
        start = Caffeinate.config.now.call
        if options[:start]
          start = OptionEvaluator.new(options[:start], self, mailing).call
Severity: Minor
Found in lib/caffeinate/schedule_evaluator.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def call
      mailings = []

      @campaign.to_dripper.drips.each do |drip|
        mailing = Caffeinate::Mailing.find_or_initialize_from_drip(@campaign_subscription, drip)
Severity: Minor
Found in app/services/campaign_subscriptions/refuel_service.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