Fix RuboCop offense Style/StringChars (#39887).

git-svn-id: https://svn.redmine.org/redmine/trunk@23009 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2024-09-01 06:05:39 +00:00
parent ab4eac416a
commit d24d11a682
2 changed files with 1 additions and 6 deletions

View File

@@ -1271,11 +1271,6 @@ Style/StderrPuts:
- 'config/environment.rb' - 'config/environment.rb'
- 'config/initializers/10-patches.rb' - 'config/initializers/10-patches.rb'
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/StringChars:
Exclude:
- 'app/models/user.rb'
# This cop supports unsafe autocorrection (--autocorrect-all). # This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode. # Configuration parameters: Mode.
Style/StringConcatenation: Style/StringConcatenation:

View File

@@ -371,7 +371,7 @@ class User < Principal
end end
chars = chars_list.flatten chars = chars_list.flatten
length.times {password << chars[SecureRandom.random_number(chars.size)]} length.times {password << chars[SecureRandom.random_number(chars.size)]}
password = password.split('').shuffle(random: SecureRandom).join password = password.chars.shuffle(random: SecureRandom).join
self.password = password self.password = password
self.password_confirmation = password self.password_confirmation = password
self self