Method update_podcast_meta_information
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_podcast_meta_information(podcast)
podcast.title ||= parsed_feed.title if parsed_feed.title
podcast.description ||= take_first(parsed_feed, [:itunes_summary, :description, :title]).strip rescue nil
text = ActionController::Base.new.view_context.strip_tags [ parsed_feed.entries.map(&:summary), podcast.description, podcast.title].join('. ')
podcast.language = text.language
- 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 update_entries
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_entries
parsed_feed.entries.each do |entry|
guid = entry.respond_to?(:entry_id) ? entry.entry_id : entry.guid
if guid.blank?
guid = entry.published && entry.published.to_s
- 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 check_redirect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_redirect
if source.url != parsed_feed.feed_url
parent = Source.where(url: parsed_feed.feed_url).first_or_initialize
parent.podcast ||= source.podcast
parent.save
- 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"