phobos/phobos_db_checkpoint

View on GitHub
lib/phobos_db_checkpoint/cli.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
Open

        [Time.now.utc.strftime('%Y%m%d%H%M%S%6N'), format('%.21d', index)].max
Severity: Minor
Found in lib/phobos_db_checkpoint/cli.rb by rubocop

Use a consistent style for named format string tokens.

Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

Example: EnforcedStyle: annotated (default)

# bad
format('%{greeting}', greeting: 'Hello')
format('%s', 'Hello')

# good
format('%<greeting>s', greeting: 'Hello')</greeting>

Example: EnforcedStyle: template

# bad
format('%<greeting>s', greeting: 'Hello')
format('%s', 'Hello')

# good
format('%{greeting}', greeting: 'Hello')</greeting>

Example: EnforcedStyle: unannotated

# bad
format('%<greeting>s', greeting: 'Hello')
format('%{greeting}', 'Hello')

# good
format('%s', 'Hello')</greeting>

There are no issues that match your filters.

Category
Status