backup/backup

View on GitHub
lib/backup/model.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Model has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Model
    class Error < Backup::Error; end
    class FatalError < Backup::FatalError; end

    class << self
Severity: Minor
Found in lib/backup/model.rb - About 3 hrs to fix

    Method after_hook has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def after_hook
          return unless after && !@before_hook_failed
    
          Logger.info "After Hook Starting..."
          after.call(exit_status)
    Severity: Minor
    Found in lib/backup/model.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 log! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def log!(action)
          case action
          when :started
            Logger.info "Performing Backup for '#{label} (#{trigger})'!\n" \
                "[ backup #{VERSION} : #{RUBY_DESCRIPTION} ]"
    Severity: Minor
    Found in lib/backup/model.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 before_hook has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def before_hook
          return unless before
    
          Logger.info "Before Hook Starting..."
          before.call
    Severity: Minor
    Found in lib/backup/model.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 perform! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def perform!
          @started_at = Time.now.utc
          @time = package.time = started_at.strftime("%Y.%m.%d.%H.%M.%S")
    
          log!(:started)
    Severity: Minor
    Found in lib/backup/model.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 set_exit_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_exit_status
          @exit_status =
            if exception
              exception.is_a?(StandardError) ? 2 : 3
            else
    Severity: Minor
    Found in lib/backup/model.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

    There are no issues that match your filters.

    Category
    Status