Fix `Style/SingleArgumentDig` cop in webpacker/manifest_extensions (#29929)

pull/2699/head
Matt Jankowski 2024-04-15 05:15:32 -04:00 committed by GitHub
parent 67dd1763bb
commit bf5d948237
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 7 deletions

View File

@ -250,11 +250,6 @@ Style/SignalException:
- 'lib/devise/strategies/two_factor_ldap_authenticatable.rb' - 'lib/devise/strategies/two_factor_ldap_authenticatable.rb'
- 'lib/devise/strategies/two_factor_pam_authenticatable.rb' - 'lib/devise/strategies/two_factor_pam_authenticatable.rb'
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SingleArgumentDig:
Exclude:
- 'lib/webpacker/manifest_extensions.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

@ -5,9 +5,9 @@ module Webpacker::ManifestExtensions
asset = super asset = super
if pack_type[:with_integrity] && asset.respond_to?(:dig) if pack_type[:with_integrity] && asset.respond_to?(:dig)
[asset.dig('src'), asset.dig('integrity')] [asset['src'], asset['integrity']]
elsif asset.respond_to?(:dig) elsif asset.respond_to?(:dig)
asset.dig('src') asset['src']
else else
asset asset
end end