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

Extract RuboCop FactoryBot from RuboCop RSpec #1

Merged
merged 1 commit into from
May 3, 2023
Merged

Conversation

ydah
Copy link
Member

@ydah ydah commented Apr 13, 2023

This PR is extract RuboCop FactoryBot from RuboCop RSpec.


Before submitting the PR make sure the following are checked:

  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Updated documentation.
  • Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

@ydah
Copy link
Member Author

ydah commented Apr 13, 2023

Steps:

git clone --no-local rubocop-rspec rubocop-factory_bot-hist
cd rubocop-factory_bot-hist
git-filter-repo $( (cat ../rubocop-factory_bot/rename | xargs -I_ echo '--path-rename _ ') )
git-filter-repo $( (cd ../rubocop-factory_bot && git ls-files) | xargs -I_ echo '--path _ ')
git remote add origin git@github.com:rubocop/rubocop-factory_bot.git
git push --set-upstream origin master
git checkout -b factory_bot-only
cd ../rubocop-factory_bot
cp -r * ../rubocop-factory_bot-hist
cp -r $( git ls-files | grep '^\.' | grep -v '\.github' ) ../rubocop-factory_bot-hist
cp -r .github ../rubocop-factory_bot-hist
cd -
git commit --all --message 'RSpec -> FactoryBot'
bundle install
bundle exec rake
git push origin factory_bot-only

rename:

docs/modules/ROOT/pages/cops_rspec_factorybot.adoc:docs/modules/ROOT/pages/cops_factorybot.adoc
lib/rubocop-rspec.rb:lib/rubocop-factory_bot.rb
lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb:lib/rubocop/cop/factory_bot/attribute_defined_statically.rb
lib/rubocop/cop/rspec/factory_bot/consistent_parentheses_style.rb:lib/rubocop/cop/factory_bot/consistent_parentheses_style.rb
lib/rubocop/cop/rspec/factory_bot/create_list.rb:lib/rubocop/cop/factory_bot/create_list.rb
lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb:lib/rubocop/cop/factory_bot/factory_class_name.rb
lib/rubocop/cop/rspec/factory_bot/factory_name_style.rb:lib/rubocop/cop/factory_bot/factory_name_style.rb
lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb:lib/rubocop/cop/factory_bot/syntax_methods.rb
lib/rubocop/cop/rspec_cops.rb:lib/rubocop/cop/factory_bot_cops.rb
lib/rubocop/rspec/config_formatter.rb:lib/rubocop/factory_bot/config_formatter.rb
lib/rubocop/rspec/description_extractor.rb:lib/rubocop/factory_bot/description_extractor.rb
lib/rubocop/rspec/factory_bot.rb:lib/rubocop/factory_bot/factory_bot.rb
lib/rubocop/rspec/factory_bot/language.rb:lib/rubocop/factory_bot/language.rb
lib/rubocop/rspec/version.rb:lib/rubocop/factory_bot/version.rb
rubocop-rspec.gemspec:rubocop-factory_bot.gemspec
spec/rubocop/cop/rspec/factory_bot/attribute_defined_statically_spec.rb:spec/rubocop/cop/factory_bot/attribute_defined_statically_spec.rb
spec/rubocop/cop/rspec/factory_bot/consistent_parentheses_style_spec.rb:spec/rubocop/cop/factory_bot/consistent_parentheses_style_spec.rb
spec/rubocop/cop/rspec/factory_bot/create_list_spec.rb:spec/rubocop/cop/factory_bot/create_list_spec.rb
spec/rubocop/cop/rspec/factory_bot/factory_class_name_spec.rb:spec/rubocop/cop/factory_bot/factory_class_name_spec.rb
spec/rubocop/cop/rspec/factory_bot/factory_name_style_spec.rb:spec/rubocop/cop/factory_bot/factory_name_style_spec.rb
spec/rubocop/cop/rspec/factory_bot/syntax_methods_spec.rb:spec/rubocop/cop/factory_bot/syntax_methods_spec.rb
spec/rubocop/rspec/config_formatter_spec.rb:spec/rubocop/factory_bot/config_formatter_spec.rb
spec/rubocop/rspec/description_extractor_spec.rb:spec/rubocop/factory_bot/description_extractor_spec.rb

Ref: rubocop-hq/rubocop-capybara#1 (comment)

rubocop-factory_bot.gemspec Outdated Show resolved Hide resolved
@pirj
Copy link
Member

pirj commented Apr 16, 2023

My only concern regarding this PR is that master would still have traces of old file versions from rubocop-rspec.
I'd rather start master from the point where factory_bot-only is.

@ydah
Copy link
Member Author

ydah commented Apr 23, 2023

My only concern regarding this PR is that master would still have traces of old file versions from rubocop-rspec. I'd rather start master from the point where factory_bot-only is.

Indeed it is. I will pushing commits directly to master instead of merging this PR.

rubocop-factory_bot.gemspec Outdated Show resolved Hide resolved
@ydah ydah force-pushed the factory_bot-only branch 2 times, most recently from 80b0e18 to af6a602 Compare April 27, 2023 15:32
README.md Outdated Show resolved Hide resolved
@ydah ydah force-pushed the factory_bot-only branch 5 times, most recently from e8aa600 to fc08c81 Compare April 27, 2023 15:57
@ydah ydah requested a review from bquorning May 2, 2023 10:26
Copy link
Contributor

@bquorning bquorning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can delete the rspec4 job from .github/workflows/main.yml, since it’s more rubocop-rspec specific.

Copy link
Contributor

@bquorning bquorning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides one comment, the changes look fine to me.

@ydah
Copy link
Member Author

ydah commented May 3, 2023

I think you can delete the rspec4 job from .github/workflows/main.yml, since it’s more rubocop-rspec specific.

Indeed it is. I updated this PR. Thank you!
If all is well, push to master and start this repository.

@ydah ydah requested a review from bquorning May 3, 2023 14:00
@ydah ydah merged commit 812771e into master May 3, 2023
@ydah ydah deleted the factory_bot-only branch May 3, 2023 14:10
@ydah ydah restored the factory_bot-only branch May 3, 2023 14:19
@pirj
Copy link
Member

pirj commented May 3, 2023

What concerns me slightly is that we kept unrelated commits from rubocop-rspec.
CFCB8B00-710C-4D59-825C-BBB6582C98A6
is this because they touched commonly present files like the changelog and default conf?
I can’t recall if it was the same for rubocop-capybara.
My apologies for such a purist question.

@pirj pirj deleted the factory_bot-only branch May 3, 2023 14:51
@ydah
Copy link
Member Author

ydah commented May 3, 2023

@pirj It seems that the common file operations remain; similar commits remain in rubocop-capybara.
rubocop/rubocop-capybara@29cdd5a

@pirj
Copy link
Member

pirj commented May 3, 2023

Please disregard my previous comment. Old unrelated commits are indeed kept there, too rubocop/rubocop-capybara@b02eb14

@pirj
Copy link
Member

pirj commented May 3, 2023

Thanks a lot for this enourmous effort, @ydah !

@bquorning
Copy link
Contributor

Oh, I too was hoping to get a “clean” commit history. But yeah, I guess it would be very labor intensive to filter commits touching the Changelog file.

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 this pull request may close these issues.

4 participants