mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Safely autocorrect Rails/DotSeparatedKeys
Inspecting 1481 files
........................................................................C................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Offenses:
app/controllers/api/v1/base_controller.rb:72:66: C: [Corrected] Rails/DotSeparatedKeys: Use the dot-separated keys instead of specifying the :scope option.
message = I18n.t(:missing_parameter, param: error.param, scope: :api)
^^^^^^^^^^^
app/controllers/api/v1/base_controller.rb:79:84: C: [Corrected] Rails/DotSeparatedKeys: Use the dot-separated keys instead of specifying the :scope option.
message = I18n.t(:unpermitted_parameters, params: error.params.join(", "), scope: :api)
^^^^^^^^^^^
1481 files inspected, 2 offenses detected, 2 offenses corrected
This commit is contained in:
@@ -478,12 +478,6 @@ Rails/CompactBlank:
|
||||
- 'lib/reporting/report_ruler.rb'
|
||||
- 'lib/reporting/reports/enterprise_fee_summary/parameters.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Rails/DotSeparatedKeys:
|
||||
Exclude:
|
||||
- 'app/controllers/api/v1/base_controller.rb'
|
||||
|
||||
# Offense count: 27
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Rails/DurationArithmetic:
|
||||
|
||||
@@ -69,14 +69,14 @@ module Api
|
||||
end
|
||||
|
||||
def missing_parameter(error)
|
||||
message = I18n.t(:missing_parameter, param: error.param, scope: :api)
|
||||
message = I18n.t('api.missing_parameter', param: error.param)
|
||||
|
||||
render status: :unprocessable_entity,
|
||||
json: json_api_error(message)
|
||||
end
|
||||
|
||||
def unpermitted_parameters(error)
|
||||
message = I18n.t(:unpermitted_parameters, params: error.params.join(", "), scope: :api)
|
||||
message = I18n.t('api.unpermitted_parameters', params: error.params.join(", "))
|
||||
|
||||
render status: :unprocessable_entity,
|
||||
json: json_api_error(message)
|
||||
|
||||
Reference in New Issue
Block a user