Commit Graph

6 Commits

Author SHA1 Message Date
Javi Martín
469b39ffa3 Add and apply Style/RedundantInterpolation rule
Somehow I thought we already had this rule; must have forgotten to
actually add it.
2021-08-09 21:37:04 +02:00
Javi Martín
d0d681a44b Add and apply EmptyLineAfterGuardClause rule
We were inconsistent on this one. I consider it particularly useful when
a method starts with a `return` statement.

In other cases, we probably shouldn't have a guard rule in the middle of
a method in any case, but that's a different refactoring.
2019-10-24 17:56:03 +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
71d9ddd849 Apply rule to end files with a newline character 2019-09-10 20:02:15 +02:00
Julian Herrero
366505f886 Return a String in I18n method 'pluralize'
If a translation was missing returning a Fixnum was raising an
exception 'undefined method X for Fixnum'.
2019-02-15 11:59:57 +01:00
voodoorai2000
be80973e44 Avoid InvalidPluralizationData exception when missing translations
We work with many languages using Crowdin[1]

Sometimes translators forget to fill in all the necessary plural forms of a translation (zero, one, other) and in those cases we were seing the exception InvalidPluralizationData being raised

There are a number of approches to fix this... from being more strict when approving translations, to automatically extrapolating what those plural forms should be

For now, we've gone for a simple approach to display the actual count(0,1,2,3,4, etc) instead of the whole translation

So, if the plural form of "1 comment" is missing, just a "1" will be displayed and no exceptions raised

Note: The first two specs, test what is really Rails' functionalities. However as we are monkey patching the pluralize method, I thought it was appropriate to doble check it

[1]https://crowdin.com/project/consul
2018-10-05 12:26:07 +02:00