lib/generators/templates/add_rpush.rb

Summary

Maintainability
D
1 day
Test Coverage

File add_rpush.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class AddRpush < ActiveRecord::Migration[5.0]
  def self.migrations
    [CreateRapnsNotifications, CreateRapnsFeedback,
     AddAlertIsJsonToRapnsNotifications, AddAppToRapns,
     CreateRapnsApps, AddGcm, AddWpns, AddAdm, RenameRapnsToRpush,
Severity: Minor
Found in lib/generators/templates/add_rpush.rb - About 2 hrs to fix

    Method up has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.up
          add_column :rapns_notifications, :type, :string, null: true
          add_column :rapns_apps, :type, :string, null: true
    
          AddGcm::Rapns::Notification.update_all type: 'Rapns::Apns::Notification'
    Severity: Minor
    Found in lib/generators/templates/add_rpush.rb - About 1 hr to fix

      Method down has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.down
            AddGcm::Rapns::Notification.where(type: 'Rapns::Gcm::Notification').delete_all
      
            remove_column :rapns_notifications, :type
            remove_column :rapns_apps, :type
      Severity: Minor
      Found in lib/generators/templates/add_rpush.rb - About 1 hr to fix

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

            def self.up
              create_table :rapns_notifications do |t|
                t.integer   :badge,                 null: true
                t.string    :device_token,          null: false, limit: 64
                t.string    :sound,                 null: true,  default: "1.aiff"
        Severity: Major
        Found in lib/generators/templates/add_rpush.rb and 1 other location - About 3 hrs to fix
        lib/generators/templates/create_rapns_notifications.rb on lines 2..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 109.

        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

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

            def self.up
              rename_table :rapns_notifications, :rpush_notifications
              rename_table :rapns_apps, :rpush_apps
              rename_table :rapns_feedback, :rpush_feedback
        
        
        Severity: Major
        Found in lib/generators/templates/add_rpush.rb and 1 other location - About 1 hr to fix
        lib/generators/templates/rename_rapns_to_rpush.rb on lines 16..37

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

        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

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

            def self.down
              update_type(RenameRapnsToRpush::Rpush::Notification, 'Rpush::Apns::Notification', 'Rapns::Apns::Notification')
              update_type(RenameRapnsToRpush::Rpush::Notification, 'Rpush::Gcm::Notification', 'Rapns::Gcm::Notification')
              update_type(RenameRapnsToRpush::Rpush::Notification, 'Rpush::Adm::Notification', 'Rapns::Adm::Notification')
              update_type(RenameRapnsToRpush::Rpush::Notification, 'Rpush::Wpns::Notification', 'Rapns::Wpns::Notification')
        Severity: Major
        Found in lib/generators/templates/add_rpush.rb and 1 other location - About 1 hr to fix
        lib/generators/templates/rename_rapns_to_rpush.rb on lines 40..62

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

        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

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

            def self.up
              create_table :rapns_apps do |t|
                t.string    :key,             null: false
                t.string    :environment,     null: false
                t.text      :certificate,     null: false
        Severity: Minor
        Found in lib/generators/templates/add_rpush.rb and 1 other location - About 50 mins to fix
        lib/generators/templates/create_rapns_apps.rb on lines 2..9

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

        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 3 locations. Consider refactoring.
        Open

            def self.up
              add_column :rapns_apps, :client_id, :string, null: true
              add_column :rapns_apps, :client_secret, :string, null: true
              add_column :rapns_apps, :access_token, :string, null: true
              add_column :rapns_apps, :access_token_expiration, :datetime, null: true
        Severity: Minor
        Found in lib/generators/templates/add_rpush.rb and 2 other locations - About 25 mins to fix
        lib/generators/templates/add_adm.rb on lines 8..13
        lib/generators/templates/rpush_3_2_0_add_apns_p8.rb on lines 2..7

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

        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

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

            def self.up
              create_table :rapns_feedback do |t|
                t.string    :device_token,          null: false, limit: 64
                t.timestamp :failed_at,             null: false
                t.timestamps
        Severity: Minor
        Found in lib/generators/templates/add_rpush.rb and 1 other location - About 20 mins to fix
        lib/generators/templates/create_rapns_feedback.rb on lines 2..10

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

        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

        There are no issues that match your filters.

        Category
        Status