backup/backup

View on GitHub

Showing 60 of 79 total issues

Method notify! has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def notify!(status)
        email = ::Mail.new
        email.to       = to
        email.from     = from
        email.cc       = cc
Severity: Minor
Found in lib/backup/notifier/ses.rb - About 1 hr to fix

    Method notify! has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def notify!(status)
            incident_description = "Backup - #{model.label}"
            incident_key = "backup/#{model.trigger}"
            incident_details = {
              incident_key: incident_key,
    Severity: Minor
    Found in lib/backup/notifier/pagerduty.rb - About 1 hr to fix

      Method initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(obj = nil, wrapped_exception = nil)
            @wrapped_exception = wrapped_exception
            msg = (obj.respond_to?(:to_str) ? obj.to_str : obj.to_s)
              .gsub(/^ */, "  ").strip
            msg = clean_name(self.class.name) + (msg.empty? ? "" : ": #{msg}")
      Severity: Minor
      Found in lib/backup/errors.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 check_configuration has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def check_configuration
              required =
                if use_iam_profile
                  %w[bucket]
                else
      Severity: Minor
      Found in lib/backup/storage/s3.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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def run
            Open4.popen4(pipeline) do |_pid, _stdin, stdout, stderr|
              pipestatus = stdout.read.delete("\n").split(":").sort
              pipestatus.each do |status|
                index, exitstatus = status.split("|").map(&:to_i)
      Severity: Minor
      Found in lib/backup/pipeline.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 command_name has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def command_name(command)
              parts = []
              command = command.split(" ")
              command.shift while command[0].to_s.include?("=")
              parts << command.shift.split("/")[-1]
      Severity: Minor
      Found in lib/backup/utilities.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 process_orphans has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def process_orphans
                if @orphans.empty?
                  return mirror ? "Deleted Files: 0" : "Orphaned Files: 0"
                end
      
      
      Severity: Minor
      Found in lib/backup/syncer/cloud/base.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 sync_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def sync_file(local_file, remote_path, remote_md5)
                if local_file && File.exist?(local_file.path)
                  if local_file.md5 == remote_md5
                    MUTEX.synchronize { @unchanged_count += 1 }
                  else
      Severity: Minor
      Found in lib/backup/syncer/cloud/base.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 prepare has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def prepare(model)
              messages = []
      
              packaging_folder = File.join(Config.tmp_path, model.trigger)
              if File.exist?(packaging_folder)
      Severity: Minor
      Found in lib/backup/cleaner.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 format_arg has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def format_arg(arg, status)
              if arg.respond_to?(:call)
                arg.call(model, status)
              else
                arg.gsub(/%(\w)/) do |match|
      Severity: Minor
      Found in lib/backup/notifier/command.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 backup_perform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def backup_perform(triggers, *options)
            triggers = Array(triggers).map(&:to_s)
            opts = options.last.is_a?(Hash) ? options.pop : {}
            exit_status = opts.delete(:exit_status)
            argv = ["perform", "-t", triggers.join(",")] + options
      Severity: Minor
      Found in integration/support/example_helpers.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 set_path_variable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def set_path_variable(name, path, ending, root_path)
              # strip any trailing '/' in case the user supplied this as part of
              # an absolute path, so we can match it against File.expand_path()
              path = path.to_s.sub(/\/\s*$/, "").lstrip
              new_path = false
      Severity: Minor
      Found in lib/backup/config.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 truncate! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def truncate!
              return unless File.exist?(@logfile)
      
              if File.stat(@logfile).size > @options.max_bytes
                FileUtils.cp(@logfile, @logfile + "~")
      Severity: Minor
      Found in lib/backup/logger/logfile.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 warnings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def warnings(model)
              messages = []
      
              packaging_folder = File.join(Config.tmp_path, model.trigger)
              if File.exist?(packaging_folder)
      Severity: Minor
      Found in lib/backup/cleaner.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 upload_parts has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def upload_parts(src, dest, upload_id, chunk_bytes, file_size)
      Severity: Minor
      Found in lib/backup/cloud_io/s3.rb - About 35 mins to fix

        Method upload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def upload(src, dest)
                file_size = File.size(src)
                chunk_bytes = chunk_size * 1024**2
                if chunk_bytes > 0 && file_size > chunk_bytes
                  raise FileSizeError, <<-EOS if file_size > MAX_MULTIPART_SIZE
        Severity: Minor
        Found in lib/backup/cloud_io/s3.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 method_missing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def method_missing(name, *args)
                deprecation = nil
                if method = name.to_s.chomp!("=")
                  if (len = args.count) != 1
                    raise ArgumentError,
        Severity: Minor
        Found in lib/backup/config/helpers.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!
                super
        
                pipeline = Pipeline.new
                dump_ext = sql_backup? ? "sql" : "tar"
        Severity: Minor
        Found in lib/backup/database/mysql.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 setup_gpg_homedir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def setup_gpg_homedir
                return false unless gpg_homedir
        
                path = File.expand_path(gpg_homedir)
                FileUtils.mkdir_p(path)
        Severity: Minor
        Found in lib/backup/encryptor/gpg.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

        Severity
        Category
        Status
        Source
        Language