Showing 6 of 6 total issues
Class Registry
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Registry
include Util
attr_reader :model_spaces
attr_reader :model_spaces_by_models
Method new_version
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def new_version(model, copy_old_version=false, &block)
raise "new_version: a block must be supplied" if !block
if get_working_model_version(model)
block.call # nothing to do
- 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 new_version
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new_version(model, copy_old_version=false, &block)
raise "new_version: a block must be supplied" if !block
if get_working_model_version(model)
block.call # nothing to do
Method update_model_space_model_versions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_model_space_model_versions(model_space_name, model_space_key, new_model_versions)
ActiveRecord::Base.transaction do
old_model_versions = read_model_space_model_versions(model_space_name, model_space_key)
new_model_versions.map do |model_or_name, new_version|
- 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 table_name
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def table_name(model_space_name, model_space_key, model, history_versions, v)
Method model_space_table_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def model_space_table_name(model_space_name, model_space_key, base_table_name)
if (!model_space_name || model_space_name.to_s.empty?) &&
(model_space_key && !model_space_key.to_s.empty?)
raise "model_space_key cannot be non-empty if model_space_name is empty"
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"