amatriain/openreader

View on GitHub

Showing 122 of 122 total issues

Avoid too many return statements within this method.
Open

    return nil
Severity: Major
Found in FeedBunch-app/app/workers/import_subscription_worker.rb - About 30 mins to fix

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def up
        add_column :users, :config_etag, :text, null: true
    
        User.all.each do |u|
          etag = OpenSSL::Digest::MD5.new.hexdigest u.config_updated_at.to_f.to_s
    FeedBunch-app/db/migrate/20150128154725_change_folder_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128162753_change_user_subscriptions_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128215215_change_user_folders_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128221026_change_user_data_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150206140025_change_folder_etag_to_last_modified.rb on lines 11..20
    FeedBunch-app/db/migrate/20150206142042_change_user_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206144903_change_user_folders_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151007_change_user_config_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151549_change_user_data_etag_to_last_modified.rb on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def down
        add_column :folders, :subscriptions_etag, :text, null: true
    
        Folder.all.each do |f|
          etag = OpenSSL::Digest::MD5.new.hexdigest f.subscriptions_updated_at.to_f.to_s
    FeedBunch-app/db/migrate/20150128154725_change_folder_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128162753_change_user_subscriptions_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128215215_change_user_folders_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128220337_change_user_config_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128221026_change_user_data_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150206142042_change_user_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206144903_change_user_folders_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151007_change_user_config_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151549_change_user_data_etag_to_last_modified.rb on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def down
        add_column :users, :subscriptions_etag, :text, null: true
    
        User.all.each do |u|
          etag = OpenSSL::Digest::MD5.new.hexdigest u.subscriptions_updated_at.to_f.to_s
    FeedBunch-app/db/migrate/20150128154725_change_folder_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128162753_change_user_subscriptions_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128215215_change_user_folders_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128220337_change_user_config_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128221026_change_user_data_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150206140025_change_folder_etag_to_last_modified.rb on lines 11..20
    FeedBunch-app/db/migrate/20150206144903_change_user_folders_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151007_change_user_config_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151549_change_user_data_etag_to_last_modified.rb on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def up
        add_column :users, :subscriptions_etag, :text, null: true
    
        User.all.each do |u|
          etag = OpenSSL::Digest::MD5.new.hexdigest u.subscriptions_updated_at.to_f.to_s
    FeedBunch-app/db/migrate/20150128154725_change_folder_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128215215_change_user_folders_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128220337_change_user_config_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128221026_change_user_data_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150206140025_change_folder_etag_to_last_modified.rb on lines 11..20
    FeedBunch-app/db/migrate/20150206142042_change_user_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206144903_change_user_folders_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151007_change_user_config_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151549_change_user_data_etag_to_last_modified.rb on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def down
        add_column :users, :config_etag, :text, null: true
    
        User.all.each do |u|
          etag = OpenSSL::Digest::MD5.new.hexdigest u.config_updated_at.to_f.to_s
    FeedBunch-app/db/migrate/20150128154725_change_folder_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128162753_change_user_subscriptions_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128215215_change_user_folders_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128220337_change_user_config_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128221026_change_user_data_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150206140025_change_folder_etag_to_last_modified.rb on lines 11..20
    FeedBunch-app/db/migrate/20150206142042_change_user_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206144903_change_user_folders_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151549_change_user_data_etag_to_last_modified.rb on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def up
        add_column :users, :user_data_etag, :text, null: true
    
        User.all.each do |u|
          etag = OpenSSL::Digest::MD5.new.hexdigest u.user_data_updated_at.to_f.to_s
    FeedBunch-app/db/migrate/20150128154725_change_folder_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128162753_change_user_subscriptions_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128215215_change_user_folders_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128220337_change_user_config_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150206140025_change_folder_etag_to_last_modified.rb on lines 11..20
    FeedBunch-app/db/migrate/20150206142042_change_user_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206144903_change_user_folders_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151007_change_user_config_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151549_change_user_data_etag_to_last_modified.rb on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def down
        add_column :users, :folders_etag, :text, null: true
    
        User.all.each do |u|
          etag = OpenSSL::Digest::MD5.new.hexdigest u.folders_updated_at.to_f.to_s
    FeedBunch-app/db/migrate/20150128154725_change_folder_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128162753_change_user_subscriptions_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128215215_change_user_folders_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128220337_change_user_config_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128221026_change_user_data_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150206140025_change_folder_etag_to_last_modified.rb on lines 11..20
    FeedBunch-app/db/migrate/20150206142042_change_user_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151007_change_user_config_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151549_change_user_data_etag_to_last_modified.rb on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def up
        add_column :folders, :subscriptions_etag, :text, null: true
    
        Folder.all.each do |f|
          etag = OpenSSL::Digest::MD5.new.hexdigest f.subscriptions_updated_at.to_f.to_s
    FeedBunch-app/db/migrate/20150128162753_change_user_subscriptions_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128215215_change_user_folders_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128220337_change_user_config_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128221026_change_user_data_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150206140025_change_folder_etag_to_last_modified.rb on lines 11..20
    FeedBunch-app/db/migrate/20150206142042_change_user_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206144903_change_user_folders_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151007_change_user_config_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151549_change_user_data_etag_to_last_modified.rb on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def up
        add_column :users, :folders_etag, :text, null: true
    
        User.all.each do |u|
          etag = OpenSSL::Digest::MD5.new.hexdigest u.folders_updated_at.to_f.to_s
    FeedBunch-app/db/migrate/20150128154725_change_folder_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128162753_change_user_subscriptions_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128220337_change_user_config_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128221026_change_user_data_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150206140025_change_folder_etag_to_last_modified.rb on lines 11..20
    FeedBunch-app/db/migrate/20150206142042_change_user_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206144903_change_user_folders_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151007_change_user_config_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151549_change_user_data_etag_to_last_modified.rb on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def down
        add_column :users, :user_data_etag, :text, null: true
    
        User.all.each do |u|
          etag = OpenSSL::Digest::MD5.new.hexdigest u.user_data_updated_at.to_f.to_s
    FeedBunch-app/db/migrate/20150128154725_change_folder_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128162753_change_user_subscriptions_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128215215_change_user_folders_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128220337_change_user_config_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150128221026_change_user_data_last_modified_to_etag.rb on lines 2..11
    FeedBunch-app/db/migrate/20150206140025_change_folder_etag_to_last_modified.rb on lines 11..20
    FeedBunch-app/db/migrate/20150206142042_change_user_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206144903_change_user_folders_etag_to_last_modified.rb on lines 12..21
    FeedBunch-app/db/migrate/20150206151007_change_user_config_etag_to_last_modified.rb on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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 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 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          column do
           panel 'Recent signed up unconfirmed users' do
             ul do
               User.where('confirmed_at is null').order('created_at DESC').limit(10).map do |user|
                 li link_to("#{user.name} (#{user.email})", admin_user_path(user))
    Severity: Minor
    Found in FeedBunch-app/app/admin/dashboard.rb and 1 other location - About 25 mins to fix
    FeedBunch-app/app/admin/dashboard.rb on lines 52..56

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 30.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        if include_read && !page.present?
          entries =  feed.entries.order 'entries.published desc, entries.created_at desc, entries.id desc'
        elsif include_read && page.present?
          entries =  feed.entries.order('entries.published desc, entries.created_at desc, entries.id desc').page page
        else
    Severity: Minor
    Found in FeedBunch-app/lib/entries_pagination.rb and 1 other location - About 25 mins to fix
    FeedBunch-app/lib/entries_pagination.rb on lines 64..70

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 30.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

      def update_config(show_main_tour: nil, show_mobile_tour: nil, show_feed_tour: nil, show_entry_tour: nil,
                        show_kb_shortcuts_tour: nil)
        new_config = {}
        new_config[:show_main_tour] = show_main_tour if !show_main_tour.nil?
        new_config[:show_mobile_tour] = show_mobile_tour if !show_mobile_tour.nil?
    Severity: Minor
    Found in FeedBunch-app/app/models/user.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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          column do
            panel 'Recent confirmed users' do
              ul do
                User.where('confirmed_at is not null').order('created_at DESC').limit(100).map do |user|
                  li link_to("#{user.name} (#{user.email})", admin_user_path(user))
    Severity: Minor
    Found in FeedBunch-app/app/admin/dashboard.rb and 1 other location - About 25 mins to fix
    FeedBunch-app/app/admin/dashboard.rb on lines 73..77

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 30.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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