Method for_submission
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.for_submission(submission)
Dir.mktmpdir do |tmpdir|
zip_path = "#{tmpdir}/submission.zip"
File.open(zip_path, 'wb') { |f| f.write(submission.return_file) }
SafeUnzipper.new.unzip(zip_path, tmpdir)
- 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 find_all_files_under
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.find_all_files_under(root_dir)
files = []
total_size = 0
Pathname(root_dir).realpath.find do |file|
next unless file.size <= MAX_INDIVIDUAL_FILE_SIZE
- 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 find_source_files_under
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.find_source_files_under(root_dir)
files = []
total_size = 0
Pathname(root_dir).realpath.find do |file|
Find.prune if file.directory? && should_skip_dir?(file)
- 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 source_file?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.source_file?(file)
return false unless file.file?
dir = file.parent.to_s
name = file.basename.to_s.downcase
name.end_with?('.java', '.jsp') ||
- 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"