Showing 4 of 7 total issues
Method scrape_poems
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def scrape_poems(poem_urls)
poem_urls.each do |poem_url|
uri = "http://www.poetryfoundation.org#{poem_url}"
begin
- 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 create_summary_present_tense
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_summary_present_tense
summary_hash = {}
@summary = "You were matched to this poem "
if @user_poem.match_type == "random"
Method search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def search
clicked_word = params[:clicked_word].downcase.gsub(/’s|[^a-z\s]/,'')
from_poem_id = params[:from_poem].to_i
poem_kw = []
poem_kw << Keyword.new(clicked_word,0,from_poem_id,:user)
- 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 match_poem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def match_poem
@results = []
if @user.birthday.present? && user_birthday_today
data_source_match("birthday")
- 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"