From 94c4b7f7f28e5ad6c9d0e856c090921d5982e117 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sun, 25 Mar 2018 19:44:58 +0300 Subject: [PATCH 1/8] Fix Style/ZeroLengthPredicate --- app/models/devise_token_auth/concerns/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/devise_token_auth/concerns/user.rb b/app/models/devise_token_auth/concerns/user.rb index 16fc4760e..496df5e9c 100644 --- a/app/models/devise_token_auth/concerns/user.rb +++ b/app/models/devise_token_auth/concerns/user.rb @@ -249,7 +249,7 @@ def remove_tokens_after_password_reset end def clean_old_tokens - while tokens.length > 0 && DeviseTokenAuth.max_number_of_devices < tokens.length + while !tokens.empty? && DeviseTokenAuth.max_number_of_devices < tokens.length oldest_client_id, _tk = tokens.min_by { |_cid, v| v[:expiry] || v['expiry'] } tokens.delete(oldest_client_id) end From a1aa7da09db54c12a39314e6565eeee6b2e0d450 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sun, 25 Mar 2018 20:39:34 +0300 Subject: [PATCH 2/8] Fix Style/TrailingCommaInHashLiteral --- app/controllers/devise_token_auth/passwords_controller.rb | 2 +- app/controllers/devise_token_auth/unlocks_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/devise_token_auth/passwords_controller.rb b/app/controllers/devise_token_auth/passwords_controller.rb index 91176b88e..18128a972 100644 --- a/app/controllers/devise_token_auth/passwords_controller.rb +++ b/app/controllers/devise_token_auth/passwords_controller.rb @@ -143,7 +143,7 @@ def render_create_success def render_create_error(errors) render json: { success: false, - errors: errors, + errors: errors }, status: 400 end diff --git a/app/controllers/devise_token_auth/unlocks_controller.rb b/app/controllers/devise_token_auth/unlocks_controller.rb index 82b984ce1..9b85981c1 100644 --- a/app/controllers/devise_token_auth/unlocks_controller.rb +++ b/app/controllers/devise_token_auth/unlocks_controller.rb @@ -70,7 +70,7 @@ def render_create_success def render_create_error(errors) render json: { success: false, - errors: errors, + errors: errors }, status: 400 end From b709eeb4e9d68a6c8129457d9e0e4db77d6e3245 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sun, 25 Mar 2018 20:47:42 +0300 Subject: [PATCH 3/8] Fix Style/PreferredHashMethods --- app/controllers/devise_token_auth/registrations_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/devise_token_auth/registrations_controller.rb b/app/controllers/devise_token_auth/registrations_controller.rb index c67a040c4..da6f6a211 100644 --- a/app/controllers/devise_token_auth/registrations_controller.rb +++ b/app/controllers/devise_token_auth/registrations_controller.rb @@ -181,9 +181,9 @@ def render_destroy_error def resource_update_method if DeviseTokenAuth.check_current_password_before_update == :attributes 'update_with_password' - elsif DeviseTokenAuth.check_current_password_before_update == :password && account_update_params.has_key?(:password) + elsif DeviseTokenAuth.check_current_password_before_update == :password && account_update_params.key?(:password) 'update_with_password' - elsif account_update_params.has_key?(:current_password) + elsif account_update_params.key?(:current_password) 'update_with_password' else 'update_attributes' From 5d5343e59ce0d287e6c7fb432ce1b8cc1f254bec Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sun, 25 Mar 2018 20:52:43 +0300 Subject: [PATCH 4/8] Fix Style/NegatedIf --- app/controllers/devise_token_auth/concerns/set_user_by_token.rb | 2 +- .../devise_token_auth/omniauth_callbacks_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/devise_token_auth/concerns/set_user_by_token.rb b/app/controllers/devise_token_auth/concerns/set_user_by_token.rb index 3ca67987e..59ffb3b36 100644 --- a/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +++ b/app/controllers/devise_token_auth/concerns/set_user_by_token.rb @@ -68,7 +68,7 @@ def set_user_by_token(mapping=nil) return @resource if @resource && @resource.is_a?(rc) # ensure we clear the client_id - if !@token + unless @token @client_id = nil return end diff --git a/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb b/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb index 5b847ccb7..0403c42d1 100644 --- a/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +++ b/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb @@ -60,7 +60,7 @@ def omniauth_failure # after use. In the failure case, finally, the omniauth params # are added as query params in our monkey patch to OmniAuth in engine.rb def omniauth_params - if !defined?(@_omniauth_params) + unless defined?(@_omniauth_params) if request.env['omniauth.params'] && request.env['omniauth.params'].any? @_omniauth_params = request.env['omniauth.params'] elsif session['dta.omniauth.params'] && session['dta.omniauth.params'].any? From 40400c0057b0b5d0993e0cb81d0a6e00dcb25dd8 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sun, 25 Mar 2018 21:03:05 +0300 Subject: [PATCH 5/8] Fix Layout/SpaceInsideHashLiteralBraces --- .../devise_token_auth/confirmations_controller.rb | 2 +- .../devise_token_auth/omniauth_callbacks_controller.rb | 2 +- app/controllers/devise_token_auth/passwords_controller.rb | 2 +- app/controllers/devise_token_auth/unlocks_controller.rb | 2 +- app/models/devise_token_auth/concerns/user.rb | 2 +- lib/devise_token_auth/rails/routes.rb | 8 ++++---- test/dummy/app/controllers/custom/passwords_controller.rb | 2 +- .../app/controllers/custom/registrations_controller.rb | 2 +- test/dummy/app/controllers/custom/sessions_controller.rb | 2 +- .../controllers/custom/token_validations_controller.rb | 2 +- test/lib/devise_token_auth/url_test.rb | 4 ++-- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/controllers/devise_token_auth/confirmations_controller.rb b/app/controllers/devise_token_auth/confirmations_controller.rb index 441cc3448..762801a5f 100644 --- a/app/controllers/devise_token_auth/confirmations_controller.rb +++ b/app/controllers/devise_token_auth/confirmations_controller.rb @@ -16,7 +16,7 @@ def show yield @resource if block_given? - redirect_header_options = {account_confirmation_success: true} + redirect_header_options = { account_confirmation_success: true } redirect_headers = build_redirect_headers(token, client_id, redirect_header_options) diff --git a/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb b/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb index 0403c42d1..95f3ef2e5 100644 --- a/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +++ b/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb @@ -46,7 +46,7 @@ def omniauth_success def omniauth_failure @error = params[:message] - render_data_or_redirect('authFailure', {error: @error}) + render_data_or_redirect('authFailure', { error: @error }) end protected diff --git a/app/controllers/devise_token_auth/passwords_controller.rb b/app/controllers/devise_token_auth/passwords_controller.rb index 18128a972..1f258b558 100644 --- a/app/controllers/devise_token_auth/passwords_controller.rb +++ b/app/controllers/devise_token_auth/passwords_controller.rb @@ -67,7 +67,7 @@ def edit yield @resource if block_given? - redirect_header_options = {reset_password: true} + redirect_header_options = { reset_password: true } redirect_headers = build_redirect_headers(token, client_id, redirect_header_options) diff --git a/app/controllers/devise_token_auth/unlocks_controller.rb b/app/controllers/devise_token_auth/unlocks_controller.rb index 9b85981c1..1ce0d6c66 100644 --- a/app/controllers/devise_token_auth/unlocks_controller.rb +++ b/app/controllers/devise_token_auth/unlocks_controller.rb @@ -39,7 +39,7 @@ def show @resource.save! yield @resource if block_given? - redirect_header_options = {unlock: true} + redirect_header_options = { unlock: true } redirect_headers = build_redirect_headers(token, client_id, redirect_header_options) diff --git a/app/models/devise_token_auth/concerns/user.rb b/app/models/devise_token_auth/concerns/user.rb index 496df5e9c..7d1d16bdd 100644 --- a/app/models/devise_token_auth/concerns/user.rb +++ b/app/models/devise_token_auth/concerns/user.rb @@ -244,7 +244,7 @@ def remove_tokens_after_password_reset if should_remove_old_tokens client_id, token_data = tokens.max_by { |cid, v| v[:expiry] || v['expiry'] } - self.tokens = {client_id => token_data} + self.tokens = { client_id => token_data } end end diff --git a/lib/devise_token_auth/rails/routes.rb b/lib/devise_token_auth/rails/routes.rb index b77e7e226..5481288b2 100644 --- a/lib/devise_token_auth/rails/routes.rb +++ b/lib/devise_token_auth/rails/routes.rb @@ -15,10 +15,10 @@ def mount_devise_token_auth_for(resource, opts) unlocks_ctrl = opts[:controllers][:unlocks] || 'devise_token_auth/unlocks' # define devise controller mappings - controllers = {sessions: sessions_ctrl, - registrations: registrations_ctrl, - passwords: passwords_ctrl, - confirmations: confirmations_ctrl} + controllers = { sessions: sessions_ctrl, + registrations: registrations_ctrl, + passwords: passwords_ctrl, + confirmations: confirmations_ctrl } controllers[:unlocks] = unlocks_ctrl if unlocks_ctrl diff --git a/test/dummy/app/controllers/custom/passwords_controller.rb b/test/dummy/app/controllers/custom/passwords_controller.rb index b59190a48..7ac364c03 100644 --- a/test/dummy/app/controllers/custom/passwords_controller.rb +++ b/test/dummy/app/controllers/custom/passwords_controller.rb @@ -33,7 +33,7 @@ def update_block_called? protected def render_update_success - render json: {custom: 'foo'} + render json: { custom: 'foo' } end end diff --git a/test/dummy/app/controllers/custom/registrations_controller.rb b/test/dummy/app/controllers/custom/registrations_controller.rb index 84a24d57e..760c33e90 100644 --- a/test/dummy/app/controllers/custom/registrations_controller.rb +++ b/test/dummy/app/controllers/custom/registrations_controller.rb @@ -33,7 +33,7 @@ def destroy_block_called? protected def render_create_success - render json: {custom: 'foo'} + render json: { custom: 'foo' } end end diff --git a/test/dummy/app/controllers/custom/sessions_controller.rb b/test/dummy/app/controllers/custom/sessions_controller.rb index bb644471c..d9bef07cb 100644 --- a/test/dummy/app/controllers/custom/sessions_controller.rb +++ b/test/dummy/app/controllers/custom/sessions_controller.rb @@ -23,7 +23,7 @@ def destroy_block_called? protected def render_create_success - render json: {custom: 'foo'} + render json: { custom: 'foo' } end end diff --git a/test/dummy/app/controllers/custom/token_validations_controller.rb b/test/dummy/app/controllers/custom/token_validations_controller.rb index 6261c0507..d395e0910 100644 --- a/test/dummy/app/controllers/custom/token_validations_controller.rb +++ b/test/dummy/app/controllers/custom/token_validations_controller.rb @@ -13,7 +13,7 @@ def validate_token_block_called? protected def render_validate_token_success - render json: {custom: 'foo'} + render json: { custom: 'foo' } end end diff --git a/test/lib/devise_token_auth/url_test.rb b/test/lib/devise_token_auth/url_test.rb index df7830d82..d383bc21e 100644 --- a/test/lib/devise_token_auth/url_test.rb +++ b/test/lib/devise_token_auth/url_test.rb @@ -3,7 +3,7 @@ class DeviseTokenAuth::UrlTest < ActiveSupport::TestCase describe 'DeviseTokenAuth::Url#generate' do test 'URI fragment should appear at the end of URL' do - params = {client_id: 123} + params = { client_id: 123 } url = 'http://example.com#fragment' assert_equal DeviseTokenAuth::Url.send(:generate, url, params), 'http://example.com?client_id=123#fragment' end @@ -15,7 +15,7 @@ class DeviseTokenAuth::UrlTest < ActiveSupport::TestCase end test 'should marge existing query params with new ones' do - params = {client_id: 123} + params = { client_id: 123 } url = 'http://example.com?a=1' assert_equal DeviseTokenAuth::Url.send(:generate, url, params), 'http://example.com?a=1&client_id=123' end From 4483706c6f5ea19cbdf01ef513636baff573ccb9 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sun, 25 Mar 2018 21:07:00 +0300 Subject: [PATCH 6/8] Fix Layout/SpaceInsideStringInterpolation --- lib/devise_token_auth/controllers/helpers.rb | 2 +- lib/generators/devise_token_auth/install_generator.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/devise_token_auth/controllers/helpers.rb b/lib/devise_token_auth/controllers/helpers.rb index 3f96880e1..3cc61801b 100644 --- a/lib/devise_token_auth/controllers/helpers.rb +++ b/lib/devise_token_auth/controllers/helpers.rb @@ -27,7 +27,7 @@ module ClassMethods # current_blogger :user # Preferably returns a User if one is signed in # def devise_token_auth_group(group_name, opts={}) - mappings = "[#{ opts[:contains].map { |m| ":#{m}" }.join(',') }]" + mappings = "[#{opts[:contains].map { |m| ":#{m}" }.join(',')}]" class_eval <<-METHODS, __FILE__, __LINE__ + 1 def authenticate_#{group_name}!(favourite=nil, opts={}) diff --git a/lib/generators/devise_token_auth/install_generator.rb b/lib/generators/devise_token_auth/install_generator.rb index 878f1062d..73ec06e1f 100644 --- a/lib/generators/devise_token_auth/install_generator.rb +++ b/lib/generators/devise_token_auth/install_generator.rb @@ -12,24 +12,24 @@ def create_initializer_file end def copy_migrations - if self.class.migration_exists?('db/migrate', "devise_token_auth_create_#{ user_class.underscore }") - say_status('skipped', "Migration 'devise_token_auth_create_#{ user_class.underscore }' already exists") + if self.class.migration_exists?('db/migrate', "devise_token_auth_create_#{user_class.underscore}") + say_status('skipped', "Migration 'devise_token_auth_create_#{user_class.underscore}' already exists") else migration_template( 'devise_token_auth_create_users.rb.erb', - "db/migrate/devise_token_auth_create_#{ user_class.pluralize.underscore }.rb" + "db/migrate/devise_token_auth_create_#{user_class.pluralize.underscore}.rb" ) end end def create_user_model - fname = "app/models/#{ user_class.underscore }.rb" + fname = "app/models/#{user_class.underscore}.rb" unless File.exist?(File.join(destination_root, fname)) template('user.rb.erb', fname) else inclusion = 'include DeviseTokenAuth::Concerns::User' unless parse_file_for_line(fname, inclusion) - + active_record_needle = (Rails::VERSION::MAJOR == 5) ? 'ApplicationRecord' : 'ActiveRecord::Base' inject_into_file fname, after: "class #{user_class} < #{active_record_needle}\n" do <<-'RUBY' # Include default devise modules. From 30ad83cd9741e5aa71c5100a95e9992449113444 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sun, 25 Mar 2018 21:10:46 +0300 Subject: [PATCH 7/8] Fix Layout/CommentIndentation --- .../devise_token_auth/omniauth_callbacks_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb b/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb index 95f3ef2e5..30b2233e8 100644 --- a/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +++ b/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb @@ -149,10 +149,10 @@ def devise_mapping def set_random_password # set crazy password for new oauth users. this is only used to prevent - # access via email sign-in. - p = SecureRandom.urlsafe_base64(nil, false) - @resource.password = p - @resource.password_confirmation = p + # access via email sign-in. + p = SecureRandom.urlsafe_base64(nil, false) + @resource.password = p + @resource.password_confirmation = p end def create_auth_params From e0d610795466b33e2724bd8a2a939171b736783e Mon Sep 17 00:00:00 2001 From: Konstantin Date: Tue, 27 Mar 2018 10:33:09 +0300 Subject: [PATCH 8/8] Update .rubocop_todo.yml --- .rubocop_todo.yml | 155 ++++++++++------------------------------------ 1 file changed, 31 insertions(+), 124 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e6000160e..4cf1775d6 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by -# `rubocop --auto-gen-config --exclude-limit 30` -# on 2018-03-23 19:22:33 -0700 using RuboCop version 0.54.0. +# `rubocop --auto-gen-config --exclude-limit 35` +# on 2018-03-27 10:31:30 +0300 using RuboCop version 0.54.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -29,12 +29,6 @@ Layout/AlignParameters: - 'test/dummy/config/initializers/omniauth.rb' - 'test/dummy/config/routes.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Layout/CommentIndentation: - Exclude: - - 'app/controllers/devise_token_auth/omniauth_callbacks_controller.rb' - # Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines. @@ -115,7 +109,7 @@ Layout/IndentationConsistency: Exclude: - 'test/dummy/tmp/generators/config/routes.rb' -# Offense count: 4 +# Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: Width, IgnoredPatterns. Layout/IndentationWidth: @@ -130,7 +124,7 @@ Layout/InitialIndentation: Exclude: - 'test/dummy/tmp/generators/config/routes.rb' -# Offense count: 20 +# Offense count: 19 # Cop supports --auto-correct. Layout/LeadingCommentSpace: Exclude: @@ -138,7 +132,6 @@ Layout/LeadingCommentSpace: - 'test/dummy/config/initializers/devise_token_auth.rb' - 'test/dummy/config/initializers/figaro.rb' - 'test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb' - - 'test/dummy/tmp/history.rb' # Offense count: 3 # Cop supports --auto-correct. @@ -222,35 +215,6 @@ Layout/SpaceInsideBlockBraces: - 'lib/devise_token_auth/rails/routes.rb' - 'test/lib/generators/devise_token_auth/install_generator_test.rb' -# Offense count: 25 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. -# SupportedStyles: space, no_space, compact -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceInsideHashLiteralBraces: - Exclude: - - 'app/controllers/devise_token_auth/confirmations_controller.rb' - - 'app/controllers/devise_token_auth/omniauth_callbacks_controller.rb' - - 'app/controllers/devise_token_auth/passwords_controller.rb' - - 'app/controllers/devise_token_auth/unlocks_controller.rb' - - 'app/models/devise_token_auth/concerns/user.rb' - - 'lib/devise_token_auth/engine.rb' - - 'lib/devise_token_auth/rails/routes.rb' - - 'test/dummy/app/controllers/custom/passwords_controller.rb' - - 'test/dummy/app/controllers/custom/registrations_controller.rb' - - 'test/dummy/app/controllers/custom/sessions_controller.rb' - - 'test/dummy/app/controllers/custom/token_validations_controller.rb' - - 'test/lib/devise_token_auth/url_test.rb' - -# Offense count: 5 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: space, no_space -Layout/SpaceInsideStringInterpolation: - Exclude: - - 'lib/devise_token_auth/controllers/helpers.rb' - - 'lib/generators/devise_token_auth/install_generator.rb' - # Offense count: 4 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. @@ -262,12 +226,6 @@ Layout/TrailingBlankLines: - 'test/dummy/lib/migration_database_helper.rb' - 'test/integration/navigation_test.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Layout/TrailingWhitespace: - Exclude: - - 'lib/generators/devise_token_auth/install_generator.rb' - # Offense count: 1 Lint/AmbiguousBlockAssociation: Exclude: @@ -311,14 +269,13 @@ Lint/UnusedBlockArgument: - 'test/dummy/app/controllers/custom/registrations_controller.rb' - 'test/dummy/config/initializers/omniauth.rb' -# Offense count: 4 +# Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods. Lint/UnusedMethodArgument: Exclude: - 'app/controllers/devise_token_auth/omniauth_callbacks_controller.rb' - 'app/controllers/devise_token_auth/unlocks_controller.rb' - - 'lib/devise_token_auth/engine.rb' - 'lib/generators/devise_token_auth/install_generator.rb' # Offense count: 3 @@ -328,17 +285,11 @@ Lint/UriEscapeUnescape: - 'test/controllers/devise_token_auth/registrations_controller_test.rb' - 'test/controllers/overrides/confirmations_controller_test.rb' -# Offense count: 3 -# Configuration parameters: CheckForMethodsWithNoSideEffects. -Lint/Void: - Exclude: - - 'test/dummy/tmp/history.rb' - -# Offense count: 36 +# Offense count: 32 Metrics/AbcSize: Max: 74 -# Offense count: 94 +# Offense count: 93 # Configuration parameters: CountComments, ExcludedMethods. Metrics/BlockLength: Max: 696 @@ -348,11 +299,11 @@ Metrics/BlockLength: Metrics/ClassLength: Max: 698 -# Offense count: 14 +# Offense count: 13 Metrics/CyclomaticComplexity: Max: 17 -# Offense count: 37 +# Offense count: 34 # Configuration parameters: CountComments. Metrics/MethodLength: Max: 63 @@ -362,7 +313,7 @@ Metrics/MethodLength: Metrics/ModuleLength: Max: 1037 -# Offense count: 13 +# Offense count: 12 Metrics/PerceivedComplexity: Max: 19 @@ -402,13 +353,6 @@ Performance/RedundantMerge: Exclude: - 'app/controllers/devise_token_auth/omniauth_callbacks_controller.rb' -# Offense count: 2 -# Cop supports --auto-correct. -Performance/RegexpMatch: - Exclude: - - 'app/validators/email_validator.rb' - - 'lib/generators/devise_token_auth/install_generator.rb' - # Offense count: 3 # Cop supports --auto-correct. Performance/StringReplacement: @@ -461,11 +405,10 @@ Style/BracesAroundHashParameters: - 'test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb' - 'test/dummy/app/controllers/overrides/passwords_controller.rb' -# Offense count: 2 +# Offense count: 1 # Cop supports --auto-correct. Style/ColonMethodCall: Exclude: - - 'lib/devise_token_auth/engine.rb' - 'lib/devise_token_auth/rails/routes.rb' # Offense count: 2 @@ -488,7 +431,7 @@ Style/DateTime: Exclude: - 'app/models/devise_token_auth/concerns/user.rb' -# Offense count: 24 +# Offense count: 22 Style/Documentation: Exclude: - 'spec/**/*' @@ -509,7 +452,6 @@ Style/Documentation: - 'lib/devise_token_auth.rb' - 'lib/devise_token_auth/controllers/helpers.rb' - 'lib/devise_token_auth/controllers/url_helpers.rb' - - 'lib/devise_token_auth/engine.rb' - 'lib/devise_token_auth/rails/routes.rb' - 'lib/devise_token_auth/url.rb' - 'lib/generators/devise_token_auth/install_generator.rb' @@ -566,6 +508,14 @@ Style/GuardClause: - 'test/dummy/app/models/user.rb' - 'test/test_helper.rb' +# Offense count: 9 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +Style/HashSyntax: + Exclude: + - 'test/dummy/tmp/generators/db/migrate/20180325180533_devise_token_auth_create_users.rb' + # Offense count: 23 # Cop supports --auto-correct. Style/IfUnlessModifier: @@ -641,15 +591,6 @@ Style/MutableConstant: - 'test/dummy/app/controllers/overrides/token_validations_controller.rb' - 'test/dummy/app/helpers/application_helper.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: both, prefix, postfix -Style/NegatedIf: - Exclude: - - 'app/controllers/devise_token_auth/concerns/set_user_by_token.rb' - - 'app/controllers/devise_token_auth/omniauth_callbacks_controller.rb' - # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, MinBodyLength. @@ -670,15 +611,13 @@ Style/Not: Style/NumericLiterals: MinDigits: 15 -# Offense count: 3 +# Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, EnforcedStyle. # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: - 'spec/**/*' - - 'app/controllers/devise_token_auth/confirmations_controller.rb' - - 'app/models/devise_token_auth/concerns/user.rb' - 'test/dummy/app/models/user.rb' # Offense count: 3 @@ -697,14 +636,6 @@ Style/PercentLiteralDelimiters: - 'app/controllers/devise_token_auth/omniauth_callbacks_controller.rb' - 'test/lib/generators/devise_token_auth/install_generator_test.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: short, verbose -Style/PreferredHashMethods: - Exclude: - - 'app/controllers/devise_token_auth/registrations_controller.rb' - # Offense count: 5 # Cop supports --auto-correct. # Configuration parameters: . @@ -723,13 +654,12 @@ Style/RedundantReturn: - 'app/models/devise_token_auth/concerns/user.rb' - 'lib/devise_token_auth/url.rb' -# Offense count: 8 +# Offense count: 7 # Cop supports --auto-correct. Style/RedundantSelf: Exclude: - 'app/controllers/devise_token_auth/concerns/set_user_by_token.rb' - 'app/models/devise_token_auth/concerns/user.rb' - - 'lib/devise_token_auth/engine.rb' # Offense count: 1 # Cop supports --auto-correct. @@ -737,22 +667,6 @@ Style/RescueModifier: Exclude: - 'app/models/devise_token_auth/concerns/user.rb' -# Offense count: 11 -# Cop supports --auto-correct. -# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist. -# Whitelist: present?, blank?, presence, try -Style/SafeNavigation: - Exclude: - - 'app/controllers/devise_token_auth/concerns/set_user_by_token.rb' - - 'app/controllers/devise_token_auth/confirmations_controller.rb' - - 'app/controllers/devise_token_auth/omniauth_callbacks_controller.rb' - - 'app/controllers/devise_token_auth/passwords_controller.rb' - - 'app/controllers/devise_token_auth/unlocks_controller.rb' - - 'app/models/devise_token_auth/concerns/user.rb' - - 'lib/devise_token_auth/engine.rb' - - 'test/dummy/app/controllers/overrides/confirmations_controller.rb' - - 'test/dummy/app/controllers/overrides/passwords_controller.rb' - # Offense count: 4 # Cop supports --auto-correct. # Configuration parameters: AllowIfMethodIsEmpty. @@ -768,6 +682,14 @@ Style/SpecialGlobalVars: Exclude: - 'devise_token_auth.gemspec' +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'test/dummy/tmp/generators/db/migrate/20180325180533_devise_token_auth_create_users.rb' + # Offense count: 7 # Cop supports --auto-correct. Style/SymbolLiteral: @@ -793,15 +715,6 @@ Style/TernaryParentheses: - 'lib/generators/devise_token_auth/install_generator.rb' - 'test/lib/generators/devise_token_auth/install_generator_test.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma -Style/TrailingCommaInHashLiteral: - Exclude: - - 'app/controllers/devise_token_auth/passwords_controller.rb' - - 'app/controllers/devise_token_auth/unlocks_controller.rb' - # Offense count: 4 # Cop supports --auto-correct. Style/UnlessElse: @@ -833,13 +746,7 @@ Style/WordArray: - 'app/controllers/devise_token_auth/omniauth_callbacks_controller.rb' - 'test/dummy/db/schema.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Style/ZeroLengthPredicate: - Exclude: - - 'app/models/devise_token_auth/concerns/user.rb' - -# Offense count: 326 +# Offense count: 317 # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Metrics/LineLength: