Skip to content

Commit

Permalink
Favor #public_send over #send using Rubocop's cop
Browse files Browse the repository at this point in the history
Devs keep using `#send` although that method does not preserve
private/protected visibility. Watching after this turned out to be quite
time-consuming while doing code review.

Currently, the Style/Send cop doesn't enforce `#public_send` however
(that's what we want). It simply discourages the use of #send. See
rubocop/rubocop#2081 (comment)
for details. So a new entry on the Code Conventions doc has been added
to overcome this limitation:
https://github.com/openfoodfoundation/openfoodnetwork/wiki/Code-Conventions#prefer-public_send-over-send
  • Loading branch information
sauloperez committed Aug 30, 2018
1 parent b4bfa3f commit 1de13a5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19_no_mixed_keys

Style/Send:
Enabled: true

Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented
Expand Down

0 comments on commit 1de13a5

Please sign in to comment.