subakva/duple

View on GitHub

Showing 4 of 4 total issues

Class Configuration has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Configuration
    HEROKU  = 'heroku'
    LOCAL   = 'local'
    VALID_TYPES = [HEROKU, LOCAL]

Severity: Minor
Found in lib/duple/configuration.rb - About 4 hrs to fix

    Method run_tasks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def run_tasks(tasks)
              tasks.each do |task|
                task.commands.each do |c|
                  source.execute(c) if c.source?
                  target.execute(c) if c.target?
    Severity: Minor
    Found in lib/duple/cli/refresh.rb - About 45 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 pg_command has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def pg_command(pg_command, flags, db_config, db_flag, tail = nil)
    Severity: Minor
    Found in lib/duple/pg_runner.rb - About 35 mins to fix

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

          def run(command, capture = false)
            log_command(command)
            record_command(command) if recorder?
      
            return if dry_run?
      Severity: Minor
      Found in lib/duple/runner.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