Class ConfigLoaderResolver
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ConfigLoaderResolver
def resolve_requires(path, hash)
config_dir = File.dirname(path)
hash.delete('require').tap do |loaded_features|
Array(loaded_features).each do |feature|
Method override_department_setting_for_cops
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def override_department_setting_for_cops(base_hash, derived_hash)
derived_hash.each_key do |key|
next unless key =~ %r{(.*)/.*}
department = Regexp.last_match(1)
- 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 resolve_inheritance
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def resolve_inheritance(path, hash, file, debug) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
inherited_files = Array(hash['inherit_from'])
base_configs(path, inherited_files, file)
.each_with_index.reverse_each do |base_config, index|
override_department_setting_for_cops(base_config, hash)
- 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_disabled_by_default
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def handle_disabled_by_default(config, new_default_configuration)
department_config = config.to_hash.reject { |cop| cop.include?('/') }
department_config.each do |dept, dept_params|
next unless dept_params['Enabled']
- 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 override_enabled_for_disabled_departments
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def override_enabled_for_disabled_departments(base_hash, derived_hash)
cops_to_disable = derived_hash.each_key.with_object([]) do |key, cops|
next unless disabled?(derived_hash, key)
cops.concat(base_hash.keys.grep(Regexp.new("^#{key}/")))
- 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 inherited_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def inherited_file(path, inherit_from, file)
if remote_file?(inherit_from)
# A remote configuration, e.g. `inherit_from: http://example.com/rubocop.yml`.
RemoteConfig.new(inherit_from, File.dirname(path))
elsif Pathname.new(inherit_from).absolute?
- 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 fix_include_paths
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def fix_include_paths(base_config_path, hash, path, key, value)
Method gem_config_path
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def gem_config_path(gem_name, relative_config_path)
if defined?(Bundler)
gem = Bundler.load.specs[gem_name].first
gem_path = gem.full_gem_path if gem
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 merge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def merge(base_hash, derived_hash, **opts)
result = base_hash.merge(derived_hash)
keys_appearing_in_both = base_hash.keys & derived_hash.keys
keys_appearing_in_both.each do |key|
if opts[:unset_nil] && derived_hash[key].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
Avoid too many return
statements within this method. Open
return true if should_merge?(base_mode, key)
Method should_union?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def should_union?(derived_hash, base_hash, root_mode, key)
return false unless base_hash[key].is_a?(Array)
derived_mode = derived_hash['inherit_mode']
return false if should_override?(derived_mode, key)
- 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"