Showing 5 of 99 total issues

File flickr_photos_importer_spec.rb has 316 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

describe FlickrPhotosImporter do
  it { is_expected.to be_retryable true }
  it { is_expected.to be_unique }
Severity: Minor
Found in spec/workers/flickr_photos_importer_spec.rb - About 3 hrs to fix

    Class TopHits has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class TopHits
      DEFAULT_PRE_TAG = '<strong>'
      DEFAULT_POST_TAG = '</strong>'
      TEXT_FIELDS = %w[title description caption].freeze
    
    
    Severity: Minor
    Found in app/queries/top_hits.rb - About 3 hrs to fix

      Method perform has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      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
      Severity: Minor
      Found in app/workers/flickr_photos_importer.rb - About 55 mins to fix

      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

        def initialize(query, size, from, flickr_groups, flickr_users, mrss_names)
      Severity: Minor
      Found in app/queries/top_hits.rb - About 45 mins to fix

        Method search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        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
        Severity: Minor
        Found in app/models/image_search.rb - About 35 mins to fix

        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

        Severity
        Category
        Status
        Source
        Language