Add and apply rules for multi-line hashes

For the HashAlignment rule, we're using the default `key` style (keys
are aligned and values aren't) instead of the `table` style (both keys
and values are aligned) because, even if we used both in the
application, we used the `key` style a lot more. Furthermore, the
`table` style looks strange in places where there are both very long and
very short keys and sometimes we weren't even consistent with the
`table` style, aligning some keys without aligning other keys.

Ideally we could align hashes to "either key or table", so developers
can decide whether keeping the symmetry of the code is worth it in a
case-per-case basis, but Rubocop doesn't allow this option.
This commit is contained in:
Javi Martín
2023-07-01 16:17:33 +02:00
parent 97aca0cf95
commit 8b13daad95
130 changed files with 676 additions and 592 deletions

View File

@@ -8,10 +8,10 @@ describe Admin::Poll::Questions::Answers::VideosController, :admin do
it "is not possible for an already started poll" do
post :create, params: {
poll_question_answer_video: {
title: "Video from started poll",
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
},
answer_id: current_answer
title: "Video from started poll",
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
},
answer_id: current_answer
}
expect(flash[:alert]).to eq "You do not have permission to carry out the action 'create' on Video."
@@ -21,8 +21,8 @@ describe Admin::Poll::Questions::Answers::VideosController, :admin do
it "is possible for a not started poll" do
post :create, params: {
poll_question_answer_video: {
title: "Video from not started poll",
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
title: "Video from not started poll",
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
},
answer_id: future_answer
}