Showing 221 of 318 total issues
Method preferred_code
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def preferred_code(preferred_code_sets, codes_attribute=:codes, value_set_map=nil)
codes_value = send(codes_attribute)
preferred_code_sets = value_set_map ? (preferred_code_sets & value_set_map.collect{|cs| cs["set"]}) : preferred_code_sets
matching_code_sets = preferred_code_sets & codes_value.keys
if matching_code_sets.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 walk_up_tree
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def walk_up_tree(preconditions)
preconditions.each do |precondition|
if (has_child_comparison(precondition))
walk_up_tree(precondition.preconditions)
end
File hqmf_vs_simple_test.rb
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fileutils'
require 'digest'
require 'simplexml_parser'
require_relative '../../../test_helper'
Method initialize
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(entry, parent, doc)
@doc = doc
@entry = entry
@restrictions = []
Method remap_arbitrary_dc_v2_diff
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def remap_arbitrary_dc_v2_diff(model)
(model.all_data_criteria + model.source_data_criteria).each do |dc|
# title and description for all are technically arbitrary values
dc.instance_variable_set(:@title, '')
dc.instance_variable_set(:@description, '')
- 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 initialize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def initialize(entry, occurrence_counters)
@entry = entry
template_map = HQMF::DataCriteria.get_template_id_map()
oid_xpath_file = File.expand_path('../data_criteria_oid_xpath.json', __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 handle_specific_and_source
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def handle_specific_and_source(occurrence_identifier, source_data_criteria_extension, source_data_criteria_root,
specific_occurrence_const, specific_occurrence)
source_data_criteria = "#{source_data_criteria_extension}_#{source_data_criteria_root}_source"
if !occurrence_identifier.blank?
# if it doesn't exist, add extracted occurrence to the map
- 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 statuses_by_definition
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.statuses_by_definition
settings_file = File.expand_path('../data_criteria.json', __FILE__)
settings_map = JSON.parse(File.read(settings_file))
all_defs = (settings_map.map {|key, value| {category: value['category'],definition:value['definition'],status:(value['status'].empty? ? nil : value['status']), sub_category: value['sub_category'],title:value['title']} unless value['not_supported']}).compact
by_categories = {}
- 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 apply_to_submeasures
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def apply_to_submeasures(subs, type, values, unpaired_type=nil, unpaired_keys=[])
new_subs = []
subs.each do |sub|
# this unless prevents us from forcing an exclusion or excepion onto a measure that has a submeasure without
# an exclusion or exception, but other populations with an exclusion or excepion.
- 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 merge_precondtion_conjunction_groups
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.merge_precondtion_conjunction_groups(preconditions_by_conjunction)
joined = []
preconditions_by_conjunction.each do |conjunction_code, preconditions|
sub_conditions = []
negated_conditions = []
- 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 from_json
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.from_json(json)
json = json.with_indifferent_access
id = json["id"] if json["id"]
code = json["code"] if json["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
Consider simplifying this complex logical expression. Open
if (ipps.size<=1 and denoms.size<=1 and nums.size<=1 and numexs.size<=1 and excls.size<=1 and denexcs.size<=1 and msrpopls.size<=1 and msrpoplexs.size<=1 and observs.size<=1)
sub_measure = {}
sub_measure[HQMF::PopulationCriteria::IPP] = HQMF::PopulationCriteria::IPP if ipps.size > 0
sub_measure[HQMF::PopulationCriteria::DENOM] = HQMF::PopulationCriteria::DENOM if denoms.size > 0
Method test_population_criteria
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_population_criteria
all_population_criteria = @doc.all_population_criteria
assert_equal 4, all_population_criteria.length
codes = all_population_criteria.collect {|p| p.code}
Method apply_temporal
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.apply_temporal(data_criteria, precondition, restriction, data_criteria_converter)
data_criteria.temporal_references ||= []
value = restriction.operator.value
type = restriction.operator.type
temporal_reference = nil
Method data_criteria_matches
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def data_criteria_matches(expected, actual)
matches = true
matches &&= actual[:description] == expected[:description]
matches &&= expected[:code_list_id] == actual[:code_list_id]
Method initialize
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(id, hqmf_id, hqmf_set_id, hqmf_version_number, cms_id, title, description, population_criteria, data_criteria, source_data_criteria, attributes, measure_period, populations=nil)
Method parse_precondition
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_precondition(precondition,data_criteria_converter)
# grab child preconditions, and parse recursively
preconditions = parse_and_merge_preconditions(precondition[:preconditions],data_criteria_converter) if precondition[:preconditions] || []
- 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 entry_matches_criteria
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def entry_matches_criteria(entry, data_criteria_info_list)
data_criteria_info_list.each do |data_criteria_info|
data_criteria = data_criteria_info['data_criteria']
data_criteria_oid = HQMFTemplateHelper.template_id_by_definition_and_status(data_criteria.definition,
data_criteria.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 parse_precondition
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse_precondition(precondition,data_criteria_converter)
# grab child preconditions, and parse recursively
preconditions = parse_and_merge_preconditions(precondition[:preconditions],data_criteria_converter) if precondition[:preconditions] || []
Method diff_hash
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def diff_hash(other, ignore_id=false, clean_reference=true)
(self.keys | other.keys).inject({}) do |diff, k|
left = self[k]
right = other[k]
right = right.gsub(/_precondition_\d+/, '') if (right && k==:reference && clean_reference)