-
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
Include rubocop-faker autocorrect in deprecation #1724
Merged
vbrazo
merged 1 commit into
faker-ruby:master
from
koic:include_rubocop_faker_autocorrect_in_deprecation
Sep 6, 2019
Merged
Include rubocop-faker autocorrect in deprecation #1724
vbrazo
merged 1 commit into
faker-ruby:master
from
koic:include_rubocop_faker_autocorrect_in_deprecation
Sep 6, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
8e84063
to
1f7ff9c
Compare
vbrazo
approved these changes
Sep 5, 2019
michebble
pushed a commit
to michebble/faker
that referenced
this pull request
Feb 16, 2020
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.
davidmorton0
pushed a commit
to davidmorton0/faker
that referenced
this pull request
Jul 12, 2021
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
Before
After
Basically, users can update by copying and pasting the command displayed in the warning, so the upgrade is easy.
I'm not sure if a dependency on 3rd party gem will be accepted.
Can you please kindly consider it?