Commit Graph

9 Commits

Author SHA1 Message Date
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
ea2aeab383 Apply rubocop Rails/FindBy rule everywhere
We didn't detect these cases because by default the rule only searches
for offenses in `app/models/`.
2019-11-08 19:15:04 +01: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
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Javi Martín
a21240b230 Use Date.current and Time.current
Using Date.today and Time.now might lead to inconsistencies if the time
zone the application uses is not the same as the system time zone.
2019-08-28 20:32:40 +02:00
voodoorai2000
dfbdc0568c Allow actions to be unexecuted
Before actions could be marked as executed. With this commit we are also allowing actions to be marked as unexecuted.
2019-04-29 15:43:53 +02:00
decabeza
91be3cf775 Fix more hound warnings 2019-03-27 15:22:14 +01:00
taitus
487c485fe0 Add new section on sidebar menu for recommended proposals
- Display recommended_proposals on new section as goals with toogle.
- Divide recommended actions into actions done and actions pending to clarify the information to the user as summary_recomended_actions.
2019-02-04 11:48:47 +01:00
Juan Salvador Pérez García
42d448248c Routes have been refactored
Dashboard routes have been refactored. Now instead of having resources
for dashboard and routes inside a dashboard namespace the proposal
routes contain a dashboar singleton containing everything related to it.
2018-09-17 15:44:45 +02:00