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"
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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)
- Read upRead up
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"