Commit Graph

19 Commits

Author SHA1 Message Date
dependabot[bot]
f4203909db Bump rubocop from 1.56.4 to 1.61.0
This version fixes false negatives for Lint/SymbolConversion when using
string interpolation, for Style/RedundantArgument when using the safe
navigation operator, for Style/RedundantParentheses when logical
operators are involved and for Style/RedundantReturn with lambda ending
with return. We're applying the new rules.

Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.56.4 to 1.61.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.56.4...v1.61.0)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-02 16:31:10 +02:00
Javi Martín
11832cc07d Make it easier to customize allowed parameters
When customizing CONSUL, one of the most common actions is adding a new
field to a form.

This requires modifying the permitted/allowed parameters. However, in
most cases, the method returning these parameters returned an instance
of `ActionController::Parameters`, so adding more parameters to it
wasn't easy.

So customizing the code required copying the method returning those
parameters and adding the new ones. For example:

```
def something_params
  params.require(:something).permit(
    :one_consul_attribute,
    :another_consul_attribute,
    :my_custom_attribute
  )
end
```

This meant that, if the `something_params` method changed in CONSUL, the
customization of this method had to be updated as well.

So we're extracting the logic returning the parameters to a method which
returns an array. Now this code can be customized without copying the
original method:

```
alias_method :consul_allowed_params, :allowed_params

def allowed_params
  consul_allowed_params + [:my_custom_attribute]
end
```
2022-04-07 19:35:40 +02:00
Javi Martín
a727dcc031 Apply Style/SymbolProc rubocop rule
This style is much more concise.
2019-10-26 20:10:32 +02:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +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
Julian Herrero
5f4a369606 Deleting a booth shift with recounts or partial results.
Show a flash message that it's not possible to delete booth shifts
when they have associated recounts or partial results. Before an
execption was raised.
2019-02-12 18:59:51 +01:00
decabeza
bc1679550b Remove incoming polls filter 2019-02-08 14:28:19 +01:00
Bertocq
62d75af892 Fix line lenght offenses at multiple controllers 2018-02-19 11:09:19 +01:00
Bertocq
3adfbcb830 Fix Shift date ranges when poll is on recounting phase 2017-10-23 20:17:42 +02:00
Bertocq
ce0a7f6fad Rubocop autocorrections 2017-10-17 22:00:00 +02:00
Bertocq
e1a7fc5dfa Merge branch 'master' into fix/shift_creation_polls 2017-10-04 15:27:54 +02:00
María Checa
5a1e5da86b Fixed poll officers search
Returning User objects was provoking conflicts retrieving attributes in the views.
2017-10-04 11:41:37 +02:00
Bertocq
15039b6c5d Load the Booth polls instead of all current/incoming on Shift creation for date ranges 2017-10-04 11:02:09 +02:00
Bertocq
49b4af5e04 Add flash error for shift creation without date, increase spec 2017-09-28 10:53:15 +02:00
Bertocq
f40a0d09ed Add Shift vote and recount date ranges, filter selected one on controller 2017-09-27 18:08:03 +02:00
Bertocq
ce92dcd088 Add Task selection on Poll Shift creation, and on shifts table 2017-09-27 14:05:25 +02:00
Angel Perez
0b708397df Add base controller for Admin:Poll controller
Fixes #1848

On branch aperez-fix-for-issue-1848
  Changes to be committed:
    new file:   app/controllers/admin/poll/base_controller.rb
    modified:   app/controllers/admin/poll/booth_assignments_controller.rb
    modified:   app/controllers/admin/poll/booths_controller.rb
    modified:   app/controllers/admin/poll/officer_assignments_controller.rb
    modified:   app/controllers/admin/poll/officers_controller.rb
    modified:   app/controllers/admin/poll/polls_controller.rb
    modified:   app/controllers/admin/poll/questions_controller.rb
    modified:   app/controllers/admin/poll/recounts_controller.rb
    modified:   app/controllers/admin/poll/results_controller.rb
    modified:   app/controllers/admin/poll/shifts_controller.rb
2017-09-13 12:22:57 -04:00
rgarcia
4527236284 adds searching for officers when creating shifts 2017-09-07 22:38:42 +02:00
rgarcia
456429f08b adds shifts 2017-08-04 21:27:30 +02:00