Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning: method redefined #735

Closed
lloeki opened this issue Aug 1, 2017 · 3 comments · Fixed by #1128
Closed

warning: method redefined #735

lloeki opened this issue Aug 1, 2017 · 3 comments · Fixed by #1128

Comments

@lloeki
Copy link

lloeki commented Aug 1, 2017

When running tests on a project depending on rails-i18n some warnings are raised (see below).

This is because with a recent rake (>=11.0), ruby warnings are now on by default.

What do you think about fixing those warnings as well as running the test suite with ruby -w (like this) ?

/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/ksh.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/ksh.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/ga.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/ga.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/lag.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/lag.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/cy.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/cy.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/br.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/br.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/mt.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/mt.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/gv.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/gv.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/tzm.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/tzm.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:7: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:7: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:79: warning: method redefined; discarding old behind
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:79: warning: previous definition of behind was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:83: warning: method redefined; discarding old ahead
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:83: warning: previous definition of ahead was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:89: warning: method redefined; discarding old downcased?
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:89: warning: previous definition of downcased? was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:93: warning: method redefined; discarding old downcased_regexp
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:93: warning: previous definition of downcased_regexp was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:98: warning: method redefined; discarding old letter?
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:98: warning: previous definition of letter? was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:102: warning: method redefined; discarding old letter_regexp
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:102: warning: previous definition of letter_regexp was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:106: warning: method redefined; discarding old lookahead_upcase
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:106: warning: previous definition of lookahead_upcase was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:110: warning: method redefined; discarding old straight_lookup
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/uk.rb:110: warning: previous definition of straight_lookup was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:10: warning: method redefined; discarding old rule
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:10: warning: previous definition of rule was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:40: warning: method redefined; discarding old upper
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:40: warning: previous definition of upper was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:57: warning: method redefined; discarding old lower
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:57: warning: previous definition of lower was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:74: warning: method redefined; discarding old upper_multi
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:74: warning: previous definition of upper_multi was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:78: warning: method redefined; discarding old lower_multi
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:78: warning: previous definition of lower_multi was here
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:82: warning: method redefined; discarding old multi_keys
/Users/lloeki/.gem/ruby/2.3.4/gems/rails-i18n-5.0.4/lib/rails_i18n/../../rails/transliteration/ru.rb:82: warning: previous definition of multi_keys was here
@pama pama closed this as completed Jan 6, 2022
@casperisfine
Copy link

@pama may I ask why this was closed? I'm having the same issue right now, I'm trying to run out test suite with all warnings and so far I discovered lots of mistakes. So I'd like to make all our dependencies warning free to make it easier to spot regressions.

I think a way to solve this would be to move all the RailsI18n::Pluralization::* modules outside of the translation files and just require them instead.

I'll open a PR.

casperisfine pushed a commit to Shopify/rails-i18n that referenced this issue Sep 18, 2024
Fix: svenfuchs#735

Whenever pluralization rules are reloaded it causes a lot of warnings:

```
lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: previous definition of rule was here
...
```

This is mostly harmless, but annoying for users who try to run with no warnings at all.
@pama
Copy link
Collaborator

pama commented Sep 18, 2024

@casperisfine can't say why, it was a while ago.

@casperisfine
Copy link

No worries. If you are interested, #1128 would fix them.

casperisfine pushed a commit to Shopify/rails-i18n that referenced this issue Sep 23, 2024
Fix: svenfuchs#735

Whenever pluralization rules are reloaded it causes a lot of warnings:

```
lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: previous definition of rule was here
...
```

This is mostly harmless, but annoying for users who try to run with no warnings at all.
casperisfine pushed a commit to Shopify/rails-i18n that referenced this issue Sep 23, 2024
Fix: svenfuchs#735

Whenever pluralization rules are reloaded it causes a lot of warnings:

```
lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: previous definition of rule was here
...
```

This is mostly harmless, but annoying for users who try to run with no warnings at all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants