Skip to content

Commit

Permalink
Merge branch 'Style/SymbolArray' into add_rubocop CHANGELOG.md Gemfil…
Browse files Browse the repository at this point in the history
…e Gemfile.lock Guardfile LICENSE README.md Rakefile app bin config coverage devise_token_auth.gemspec lib tags test Style/SymbolArray: Use percent array literals for large arrays of symbols. Use percent array literals for large arrays of symbols. Move `Style/SymbolArray` from todos to main config.
  • Loading branch information
Evan-M committed Mar 26, 2018
2 parents c609d57 + 5b1af54 commit 22d2eeb
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
14 changes: 14 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,17 @@ Style/ClassAndModuleChildren:
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19

# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, MinSize.
# SupportedStyles: percent, brackets
#
# Description from Rubocop Manual:
# Check for array literals made up of symbols that are not using
# the `%i()` syntax.
#
# https://rubocop.readthedocs.io/en/latest/cops_style/#stylesymbolarray
Style/SymbolArray:
Enabled: true
EnforcedStyle: percent
MinSize: 3
7 changes: 0 additions & 7 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -752,13 +752,6 @@ Style/SpecialGlobalVars:
Exclude:
- 'devise_token_auth.gemspec'

# Offense count: 24
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, MinSize.
# SupportedStyles: percent, brackets
Style/SymbolArray:
Enabled: false

# Offense count: 10
# Cop supports --auto-correct.
Style/SymbolLiteral:
Expand Down
2 changes: 1 addition & 1 deletion app/models/devise_token_auth/concerns/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def confirmed?
end

def token_validation_response
as_json(except: [:tokens, :created_at, :updated_at])
as_json(except: %i[tokens created_at updated_at])
end

def token_lifespan
Expand Down
4 changes: 1 addition & 3 deletions test/dummy/app/controllers/overrides/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ def create
@resource.save

render json: {
data: @resource.as_json(except: [
:tokens, :created_at, :updated_at
]),
data: @resource.as_json(except: %i[tokens created_at updated_at]),
override_proof: OVERRIDE_PROOF
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ def validate_token
if @resource
render json: {
success: true,
data: @resource.as_json(except: [
:tokens, :created_at, :updated_at
]),
data: @resource.as_json(except: %i[tokens created_at updated_at]),
override_proof: OVERRIDE_PROOF
}
else
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ use Rack::Cors do
resource '*',
headers: :any,
expose: ['access-token', 'expiry', 'token-type', 'uid', 'client'],
methods: [:get, :post, :options, :delete, :put]
methods: %i[get post options delete put]
end
end

0 comments on commit 22d2eeb

Please sign in to comment.