phobos/phobos_db_checkpoint

View on GitHub

Showing 2 of 5 total issues

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

      def copy_migrations
        ENV['DB_CONFIG'] = options[:config] if options[:config]

        PhobosDBCheckpoint.configure unless active_connection?

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

    def around_consume(payload, metadata)
      event, event_metadata = build_event_and_metadata(payload, metadata)

      instrument('db_checkpoint.around_consume', event_metadata) do
        return if event_exists?(event, event_metadata)
Severity: Minor
Found in lib/phobos_db_checkpoint/handler.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

Severity
Category
Status
Source
Language