File data_criteria.rb
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
module HQMF2
# Represents a data criteria specification
class DataCriteria
include HQMF2::Utilities, HQMF2::DataCriteriaTypeAndDefinitionExtraction, HQMF2::DataCriteriaPostProcessing
Method clone
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def clone
other = DataCriteria.new(@entry, @data_criteria_references, @occurrences_map)
other.instance_variable_set(:@id, @id)
other.instance_variable_set(:@original_id, @original_id)
other.instance_variable_set(:@property, @property)
Method extract_field_values
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.extract_field_values(entry, negation)
fields = {}
# extract most fields which use the same structure
entry.xpath('./*/cda:outboundRelationship[*/cda:code]', HQMF2::Document::NAMESPACES).each do |field|
code = HQMF2::Utilities.attr_val(field, './*/cda:code/@code')
- 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 duplicate_child_info
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def duplicate_child_info(child_ref)
@title ||= child_ref.title
@type ||= child_ref.subset_operators
@definition ||= child_ref.definition
@status ||= child_ref.status
- 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 to_model
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_model
mv = value.try(:to_model)
met = effective_time.try(:to_model)
mtr = temporal_references.collect(&:to_model)
mso = subset_operators.collect(&:to_model)
- 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 retrieve_field_values_model_for_model
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def retrieve_field_values_model_for_model
field_values = {}
@field_values.each_pair do |id, val|
field_values[id] = val.to_model
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 extract_description
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract_description
if @variable
encoded_name = attr_val('./cda:localVariableName/@value')
encoded_name = DataCriteriaMethods.extract_description_for_variable(encoded_name) if encoded_name
return encoded_name if encoded_name.present?
- 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 extract_variable_grouper
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_variable_grouper
return unless @variable
@variable = false
@id = "GROUP_#{@id}"
if @children_criteria.length == 1 && @children_criteria[0] =~ /GROUP_/
- 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"