Class Assessment
has 81 methods (exceeds 20 allowed). Consider refactoring. Open
class Assessment < ApplicationRecord
# Mass-assignment
# attr_protected :name
# Associations
File assessment.rb
has 509 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "archive"
require "association_cache"
require "fileutils"
require "utilities"
class Assessment < ApplicationRecord
Method deserialize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def deserialize(s)
unless s["general"]
raise "General section missing in yaml"
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 deserialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deserialize(s)
unless s["general"]
raise "General section missing in yaml"
end
Method backwards_compatibility
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def backwards_compatibility(props)
GENERAL_BC.each do |old, new|
next unless props["general"].key?(old)
props["general"][new] = props["general"][old] unless new.nil?
- 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 load_dir_to_tar
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_dir_to_tar(dir_path, asmt_dir, tar, filters = [], export_dir = "")
Dir[File.join(dir_path, asmt_dir, "**")].each do |file|
mode = File.stat(file).mode
relative_path = file.sub(%r{^#{Regexp.escape dir_path}/?}, "")
export_path = if export_dir == ""
- 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 load_dir_to_tar
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def load_dir_to_tar(dir_path, asmt_dir, tar, filters = [], export_dir = "")
Method handin_directory_and_filename_or_disable_handins
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handin_directory_and_filename_or_disable_handins
if disable_handins?
true
else
d = handin_directory.blank?
- 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 load_config_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_config_file
# read from source
config_source = File.open(unique_source_config_file_path, "r", &:read)
# validate syntax of config
- 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"