Commit Graph

11 Commits

Author SHA1 Message Date
taitus
76837919b8 Remove redundant .all in .all.sample calls
Rubocop doesn't detect this method because we've added it in the
ApplicationRecord class, but we're removing the `.all` calls for
consistency.
2023-11-20 14:23:41 +01:00
Javi Martín
8b13daad95 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.
2023-08-18 14:56:16 +02:00
Javi Martín
7ca55c44e0 Apply Rails/SaveBang rubocop rule
Having exceptions is better than having silent bugs.

There are a few methods I've kept the same way they were.

The `RelatedContentScore#score_with_opposite` method is a bit peculiar:
it creates scores for both itself and the opposite related content,
which means the opposite related content will try to create the same
scores as well.

We've already got a test to check `Budget::Ballot#add_investment` when
creating a line fails ("Edge case voting a non-elegible investment").

Finally, the method `User#send_oauth_confirmation_instructions` doesn't
update the record when the email address isn't already present, leading
to the test "Try to register with the email of an already existing user,
when an unconfirmed email was provided by oauth" fo fail if we raise an
exception for an invalid user. That's because updating a user's email
doesn't update the database automatically, but instead a confirmation
email is sent.

There are also a few false positives for classes which don't have bang
methods (like the GraphQL classes) or destroying attachments.

For these reasons, I'm adding the rule with a "Refactor" severity,
meaning it's a rule we can break if necessary.
2019-10-23 14:39:31 +02:00
decabeza
abdeafc2dd Fix hound warnings on dev_seeds 2019-02-25 15:34:15 +01:00
Javi Martín
0a710a77f2 Add progress bars dev seeds 2019-01-24 12:03:02 +01:00
Javi Martín
7317238382 Reduce the number of locales for milestones seeds
Creating records for every locale was taking too long now that CONSUL is
available in 15 languages.
2019-01-24 12:03:02 +01:00
Javi Martín
210ab69197 Add milestone seeds to legislation processs 2019-01-24 12:03:02 +01:00
Javi Martín
7891efee32 Add milestones to proposals 2018-12-11 20:09:30 +01:00
Javi Martín
abe8527e54 Randomize milestones per record in dev seeds 2018-12-11 19:22:55 +01:00
Javi Martín
1c531cfc00 Randomize milestones publication date in dev seeds 2018-12-11 19:22:55 +01:00
Javi Martín
2fdd367f22 Move milestone dev seeds to their own file 2018-12-11 19:22:55 +01:00