amatriain/feedbunch

View on GitHub

Showing 67 of 122 total issues

Method subscribe_new_feed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.subscribe_new_feed(user, feed_url)
    Rails.logger.info "Feed #{feed_url} not in the database, trying to fetch it"
    feed = Feed.create! fetch_url: feed_url, title: feed_url
    begin
      fetched_feed = FeedClient.fetch feed, http_caching: false, perform_autodiscovery: true
Severity: Minor
Found in FeedBunch-app/lib/url_subscriber.rb - About 25 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 subscribed_feeds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.subscribed_feeds(user, include_read: false, page: nil)
    if include_read && !page.present?
      feeds =  user.feeds.order 'title asc'
    elsif include_read && page.present?
      feeds =  user.feeds.order('title asc').page page
Severity: Minor
Found in FeedBunch-app/lib/feeds_pagination.rb - About 25 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 fetch_feed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.fetch_feed(url)
    Rails.logger.info "URL #{url} belongs to a Tumblr domain possibly with a GDPR interstitial page, using a full browser to fetch it"

    if Feedbunch::Application.config.headless_browser_location == 'remote'
      Rails.logger.info "Using a remote browser in host #{Feedbunch::Application.config.headless_browser_host}, port #{Feedbunch::Application.config.headless_browser_port}"
Severity: Minor
Found in FeedBunch-app/lib/tumblr_feed_fetcher.rb - About 25 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 read_data_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.read_data_file(file)
    begin
      zip_file = Zip::File.open file
      file_contents = search_zip zip_file, /subscriptions.xml\z/
      file_contents = search_zip zip_file, /.opml\z/ if file_contents.blank?
Severity: Minor
Found in FeedBunch-app/lib/opml_importer.rb - About 25 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 show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    if OpmlExportJobState.exists? user_id: current_user.id
      @opml_export_job_state = OpmlExportJobState.find_by user_id: current_user.id
    else
      Rails.logger.warn "User #{current_user.id} - #{current_user.email} has no OpmlExportJobState, creating one with state NONE"
Severity: Minor
Found in FeedBunch-app/app/controllers/api/opml_exports_controller.rb - About 25 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 process_opml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.process_opml(filename, user)
    # Open file and check if it actually exists
    xml_contents = Feedbunch::Application.config.uploads_manager.read user.id, FOLDER, filename
    if xml_contents == nil
      Rails.logger.error "Trying to import for user #{user.id} from non-existing OPML file: #{filename}"
Severity: Minor
Found in FeedBunch-app/lib/opml_importer.rb - About 25 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 show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    if OpmlImportJobState.exists? user_id: current_user.id
      @opml_import_job_state = OpmlImportJobState.find_by user_id: current_user.id
    else
      Rails.logger.warn "User #{current_user.id} - #{current_user.email} has no OpmlImportJobState, creating one with state NONE"
Severity: Minor
Found in FeedBunch-app/app/controllers/api/opml_imports_controller.rb - About 25 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