Showing 6 of 6 total issues
Method get_processed_phone_numbers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_processed_phone_numbers(phone_numbers)
return [] if phone_numbers.nil? || phone_numbers.empty?
unescaped_contacts = phone_numbers.map { |phone_number| unescape_html(phone_number) }
good_phone_numbers = []
- 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 perform_scrape
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def perform_scrape(url, read_timeout, open_timeout)
timeout_in_sec = scraper_timeout(read_timeout, open_timeout)
Timeout::timeout(timeout_in_sec) do
response = ScrapeRequest.new(url, read_timeout, open_timeout)
retry_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"
Further reading
Method scrape_profile
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def scrape_profile(response, regexes)
return if response.to_s.empty? || regexes.empty?
profiles = []
regexes.each do |regex|
- 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 scrape_description
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def scrape_description(response, regexes)
return if response.to_s.empty? || regexes.empty?
description = nil
regexes.each do |regex|
- 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 grep_title
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def grep_title(response)
return if !response.is_a?(String) || response.empty?
title_regex = /<\s*title.*?>(.*?)<?\s*\/?title\s*?>/im
title = response.match(title_regex).captures[0].strip rescue 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
Method grep_redirected_to_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def grep_redirected_to_url(response)
return if response.nil? || response.empty?
patterns = [
%r{(?im)<link\s+[\s\w="'-]*rel\s*=\s*(?:"|')canonical(?:"|')[\s\w='"-]*?\s+href\s*=\s*(?:"|')([^"']*)(?:"|')[\s\w='"-]*?(?:>|\/>)},
- 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"