-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
2.2.0 triggers deprecation warnings from...inside the gem #1714
Comments
@linkyndy which version were you using before? < 2? |
We had 1.9.3. |
We knew that switching from positional parameters to keywords parameters would be painful, but we believed that keyword parameters would help us by providing self documentation. We also changed the Thanks for raising this issue. We've received other pieces of feedback, we consider all of them and are always happy to discuss and evolve Faker together 👍 |
FYI, I created RuboCop Faker gem. The following command can be used to check and auto-correct the Faker 2 argument style. Check positional argument style before Faker 2. % rubocop --require rubocop-faker --only Faker/DeprecatedArguments Auto-correction to keyword argument style on Faker 2. % rubocop --require rubocop-faker --only Faker/DeprecatedArguments --auto-correct This is the approach that factory_bot used to change APIs. The migration command was displayed with a deprecation warning at runtime. |
Follow up faker-ruby#1714. This is a proposal to make it easy to convert positional arguments to keyword arguments. This approach is based on the experience that factory_bot has provided for upgrades. - thoughtbot/factory_bot@dabacda - thoughtbot/factory_bot#1135 First, I prepared rubocop-faker gem for upgrading with auto-correction. https://github.com/koic/rubocop-faker This PR includes rubocop-faker autocorrect in deprecation. The following is an example. ```console % cat example.rb require 'faker' Faker::Lorem.words(10000, true) ``` ## Before ```console % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(supplemental: ...)` instead. ``` ## After ```console % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `words` is deprecated. Use keyword argument like `words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `words` is deprecated. Use keyword argument like `words(supplemental: ...)` instead. To automatically update from positional arguments to keyword arguments, install rubocop-faker and run: rubocop \ --require rubocop-faker \ --only Faker/DeprecatedArguments \ --auto-correct ``` Basically, users can update by copying and pasting the command displayed in the warning, so the upgrade is easy.
Follow up faker-ruby#1714. This is a proposal to make it easy to convert positional arguments to keyword arguments. This approach is based on the experience that factory_bot has provided for upgrades. - thoughtbot/factory_bot@dabacda - thoughtbot/factory_bot#1135 First, I prepared rubocop-faker gem for upgrading with auto-correction. https://github.com/koic/rubocop-faker This PR includes rubocop-faker autocorrect in deprecation. The following is an example. ```console % cat example.rb require 'faker' Faker::Lorem.words(10000, true) ``` ## Before ```console % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(supplemental: ...)` instead. ``` ## After ```console % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `words` is deprecated. Use keyword argument like `words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `words` is deprecated. Use keyword argument like `words(supplemental: ...)` instead. To automatically update from positional arguments to keyword arguments, install rubocop-faker and run: rubocop \ --require rubocop-faker \ --only Faker/DeprecatedArguments \ --auto-correct ``` Basically, users can update by copying and pasting the command displayed in the warning, so the upgrade is easy.
Follow up #1714. This is a proposal to make it easy to convert positional arguments to keyword arguments. This approach is based on the experience that factory_bot has provided for upgrades. - thoughtbot/factory_bot@dabacda - thoughtbot/factory_bot#1135 First, I prepared rubocop-faker gem for upgrading with auto-correction. https://github.com/koic/rubocop-faker This PR includes rubocop-faker autocorrect in deprecation. The following is an example. ```console % cat example.rb require 'faker' Faker::Lorem.words(10000, true) ``` ## Before ```console % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(supplemental: ...)` instead. ``` ## After ```console % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `words` is deprecated. Use keyword argument like `words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `words` is deprecated. Use keyword argument like `words(supplemental: ...)` instead. To automatically update from positional arguments to keyword arguments, install rubocop-faker and run: rubocop \ --require rubocop-faker \ --only Faker/DeprecatedArguments \ --auto-correct ``` Basically, users can update by copying and pasting the command displayed in the warning, so the upgrade is easy.
I am having the same problem and it comes from a file within Faker, not in my own code. Not much I can do to fix it in my project.
|
Follow up faker-ruby#1714. This is a proposal to make it easy to convert positional arguments to keyword arguments. This approach is based on the experience that factory_bot has provided for upgrades. - thoughtbot/factory_bot@dabacda - thoughtbot/factory_bot#1135 First, I prepared rubocop-faker gem for upgrading with auto-correction. https://github.com/koic/rubocop-faker This PR includes rubocop-faker autocorrect in deprecation. The following is an example. ```console % cat example.rb require 'faker' Faker::Lorem.words(10000, true) ``` ## Before ```console % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(supplemental: ...)` instead. ``` ## After ```console % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `words` is deprecated. Use keyword argument like `words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `words` is deprecated. Use keyword argument like `words(supplemental: ...)` instead. To automatically update from positional arguments to keyword arguments, install rubocop-faker and run: rubocop \ --require rubocop-faker \ --only Faker/DeprecatedArguments \ --auto-correct ``` Basically, users can update by copying and pasting the command displayed in the warning, so the upgrade is easy.
Follow up faker-ruby#1714. This is a proposal to make it easy to convert positional arguments to keyword arguments. This approach is based on the experience that factory_bot has provided for upgrades. - thoughtbot/factory_bot@dabacda - thoughtbot/factory_bot#1135 First, I prepared rubocop-faker gem for upgrading with auto-correction. https://github.com/koic/rubocop-faker This PR includes rubocop-faker autocorrect in deprecation. The following is an example. ```console % cat example.rb require 'faker' Faker::Lorem.words(10000, true) ``` ## Before ```console % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `Lorem.words` is deprecated. Use keyword argument like `Lorem.words(supplemental: ...)` instead. ``` ## After ```console % bundle exec ruby example.rb example.rb:3: Passing `number` with the 1st argument of `words` is deprecated. Use keyword argument like `words(number: ...)` instead. example.rb:3: Passing `supplemental` with the 2nd argument of `words` is deprecated. Use keyword argument like `words(supplemental: ...)` instead. To automatically update from positional arguments to keyword arguments, install rubocop-faker and run: rubocop \ --require rubocop-faker \ --only Faker/DeprecatedArguments \ --auto-correct ``` Basically, users can update by copying and pasting the command displayed in the warning, so the upgrade is easy.
Describe the bug
Trying to update the gem to 2.2.0 and we get a lot of deprecation warnings from inside the gem:
We've spend a significant amount of time trying to fix all these warnings, which also translated to errors in some places (which is highly unsual for a minor gem update). Now we're seeing warnings coming from the gem itself. I would recommend being a bit more careful when releasing changes like these, since they affect quite a big number of apps, which may or may not have the time to spend on something less then non-critical 😊
The text was updated successfully, but these errors were encountered: