Showing 5 of 99 total issues
File flickr_photos_importer_spec.rb
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'rails_helper'
describe FlickrPhotosImporter do
it { is_expected.to be_retryable true }
it { is_expected.to be_unique }
Class TopHits
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class TopHits
DEFAULT_PRE_TAG = '<strong>'
DEFAULT_POST_TAG = '</strong>'
TEXT_FIELDS = %w[title description caption].freeze
Method perform
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def perform(id, profile_type, days_ago = nil)
page = 1
pages = 1
min_ts = days_ago.present? ? days_ago.days.ago.to_i : 0
oldest_retrieved_ts = Time.now.to_i
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(query, size, from, flickr_groups, flickr_users, mrss_names)
Method search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def search
image_search_results = execute_client_search
ensure_no_suggestion_when_results_present(image_search_results)
if image_search_results.total.zero? && image_search_results.suggestion.present?
suggestion = image_search_results.suggestion
- 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"