Open
Description
Have issue with this cop on the project: https://docs.rubocop.org/rubocop/cops_layout.html#layoutfirsthashelementindentation
We have this configuration
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
But for that code (which looks correct)
respond_to do |format|
format.json {
render json: {
data: {
employee: @employee,
message: "Associate was successfully created.",
},
},
status: :created
}
end
we have this notifications
app/controllers/***_controller.rb:27:13: C: [Correctable] Layout/FirstHashElementIndentation: Use 2 spaces for indentation in a hash, relative to the parent hash key.
data: { ...
^^^^^^^
app/controllers/***_controller.rb:31:11: C: [Correctable] Layout/FirstHashElementIndentation: Indent the right brace the same as the parent hash key.
},
^
app/controllers/***_controller.rb:32:11: C: [Correctable] Layout/ArgumentAlignment: Use one level of indentation for arguments following the first line of a multi-line method call.
status: :created
^^^^^^^^^^^^^^^^
app/controllers/***_controller.rb:60:11: C: [Correctable] Layout/FirstHashElementIndentation: Use 2 spaces for indentation in a hash, relative to the parent hash key.
data: { ...
^^^^^^^
app/controllers/***_controller.rb:63:9: C: [Correctable] Layout/FirstHashElementIndentation: Indent the right brace the same as the parent hash key.
},
^
app/controllers/***_controller.rb:64:9: C: [Correctable] Layout/ArgumentAlignment: Use one level of indentation for arguments following the first line of a multi-line method call.
status: :ok
^^^^^^^^^^^
and rubocop corrects it to the next variant:
respond_to do |format|
format.json {
render json: {
data: {
employee: @employee,
message: "Associate was successfully created.",
},
},
status: :created
}
end