backup/backup

View on GitHub
lib/backup/syncer/cloud/base.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method sync_in_threads has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def sync_in_threads(relative_paths, sync_block)
          queue = Queue.new
          queue << relative_paths.shift until relative_paths.empty?
          num_threads = [thread_count, queue.size].min
          Logger.info "\s\sUsing #{num_threads} Threads"
Severity: Minor
Found in lib/backup/syncer/cloud/base.rb - About 2 hrs 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 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_directory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def sync_directory(dir)
          remote_base = path.empty? ? File.basename(dir) :
                                      File.join(path, File.basename(dir))
          Logger.info "Gathering remote data for '#{remote_base}'..."
          remote_files = get_remote_files(remote_base)
Severity: Minor
Found in lib/backup/syncer/cloud/base.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

There are no issues that match your filters.

Category
Status