Class Manager
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Manager
# @return [Pathname] The directory that contains the source repo
# directories.
#
attr_reader :repos_dir
Method name_for_url
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def name_for_url(url)
base_from_host_and_path = lambda do |host, path|
if host && !host.empty?
domain = PublicSuffix.parse(host) rescue nil
base = [domain&.sld || host]
- 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
File manager.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'public_suffix'
module Pod
class Source
class Manager
Method update_search_index_if_needed
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update_search_index_if_needed(changed_spec_paths)
search_index = stored_search_index
return unless search_index
changed_spec_paths.each_pair do |source, spec_paths|
next unless source.indexable?
- 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 name_for_url
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def name_for_url(url)
base_from_host_and_path = lambda do |host, path|
if host && !host.empty?
domain = PublicSuffix.parse(host) rescue nil
base = [domain&.sld || host]
Method search_by_name
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def search_by_name(query, full_text_search = false)
query_word_regexps = query.split.map { |word| /#{word}/i }
if full_text_search
query_word_results_hash = {}
updated_search_index.each_value do |word_spec_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 search_by_name
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search_by_name(query, full_text_search = false)
query_word_regexps = query.split.map { |word| /#{word}/i }
if full_text_search
query_word_results_hash = {}
updated_search_index.each_value do |word_spec_hash|
Method sorted_sets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sorted_sets(sets, query_word_regexps)
sets.sort_by! do |set|
pre_match_length = nil
found_query_index = nil
found_query_count = 0
- 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"