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 capybara #1

Closed
wants to merge 13 commits into from
Closed

Extract capybara #1

wants to merge 13 commits into from

Conversation

pirj
Copy link
Collaborator

@pirj pirj commented Dec 18, 2022

No description provided.

@pirj pirj force-pushed the extract-capybara branch 2 times, most recently from 2291a6d to ffa14ee Compare December 18, 2022 13:04
.github/CONTRIBUTING.md Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Self-review

Rakefile Outdated Show resolved Hide resolved
YARD::Tags::Library.define_tag('Cop Safety Information', :safety)
YARD.parse(Dir[glob].prepend(rspec_cop_path), [])
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We may need to get this back if we introduce a base class.

lib/rubocop-capybara.rb Outdated Show resolved Hide resolved
lib/rubocop/capybara.rb Outdated Show resolved Hide resolved
lib/rubocop/capybara/version.rb Outdated Show resolved Hide resolved
'git@nilsgemeinhardt.de'
]
spec.homepage = 'https://github.com/rubocop/rubocop-capybara'
spec.authors = ['foo'] # TODO
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Speaking about authors, @ydah you seem to have added more than a half of cops.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you need an email address, use the following
t.yudai92@gmail.com

rubocop-capybara.gemspec Outdated Show resolved Hide resolved
@ydah
Copy link
Contributor

ydah commented Dec 21, 2022

[ask] Should we move it to https://github.com/rubocop/rubocop-capybara?

.rubocop.yml Show resolved Hide resolved
- Gem is no longer 20MB (sorry!). ([@nevir])
- `RspecFileName` cop allows for method specs to organized into directories by class and type. ([@nevir])

## 1.0.rc1

Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary line breaks are likely here.

@pirj
Copy link
Collaborator Author

pirj commented Dec 21, 2022

move it to https://github.com/rubocop/rubocop-capybara?

I'd love to move the final result there. With only history related to files currently in the repository, without the noise about all past unrelated RSpec cop changes.

I still have one idea left - to let git-filter-repo handle the renames. I'll give it a shot soon.

But this PR still stands, as it has all the needed changes, and the resulting file structure and contents are the same.

# @!method as_is_matcher(node)
def_node_matcher :as_is_matcher, <<-PATTERN
(send
#expectation_set_on_current_path ${:to :to_not :not_to}
Copy link
Contributor

@ydah ydah Dec 21, 2022

Choose a reason for hiding this comment

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

Perhaps, but it seems that there are still remnants of RuboCop RSpec here. I think ${:to :to_not :not_to} is a peculiar RSpec expression.

But we believe this can be followed up later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see those options:

  • keep this cop in rubocop-rspec, since it's specific to RSpec
  • keep this cop here, since it's specific to Capybara
  • extract to rubocop-rspec-capybara or rubocop-capybara-rspec
  • keep this cop here, but move it to Capybara/RSpec sub-department

What is your take on this?

Copy link
Contributor

@ydah ydah Dec 21, 2022

Choose a reason for hiding this comment

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

  • keep this cop here, since it's specific to Capybara
  • keep this cop here, but move it to Capybara/RSpec sub-department

These opinions seem to be good to me.

Would it be good to have a sub-department for each where Expectation is involved 🤔.
There may be unintended side effects if one tries to handle it in one cop. But I haven't found a specific problem yet.

@pirj pirj requested a review from ydah December 21, 2022 09:30
Copy link
Contributor

@ydah ydah left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the great work 🚀

@pirj
Copy link
Collaborator Author

pirj commented Dec 22, 2022

I've figured out a reliable and more or less simple method to keep the history for a limited number of files in the repo:

git clone --no-local rubocop-rspec rubocop-capybara-hist
cd rubocop-capybara-hist
git-filter-repo $( (cat ../rubocop-capybara/rename | xargs -I_ echo '--path-rename _ ') )
git-filter-repo $( (cd ../rubocop-capybara && git ls-files) | xargs -I_ echo '--path _ ')
git remote add origin git@github.com:rubocop/rubocop-capybara.git
git push --set-upstream origin master
git checkout -b capybara-only
cd ../rubocop-capybara
cp -r * ../rubocop-capybara-hist
cp -r $( git ls-files | grep '^\.' | grep -v '\.github' ) ../rubocop-capybara-hist
cp -r .github ../rubocop-capybara-hist
cd -
git commit --all --message 'RSpec -> Capybara'
rvm use --create 3.0.4@rubocop-capybara
bundle
rake
git push origin capybara-only
hub pull-request --assign pirj

rename:

docs/modules/ROOT/pages/cops_rspec_capybara.adoc:docs/modules/ROOT/pages/cops_capybara.adoc
docs/modules/ROOT/pages/development.adoc:docs/modules/ROOT/pages/development.adoc
docs/modules/ROOT/pages/index.adoc:docs/modules/ROOT/pages/index.adoc
docs/modules/ROOT/pages/installation.adoc:docs/modules/ROOT/pages/installation.adoc
docs/modules/ROOT/pages/usage.adoc:docs/modules/ROOT/pages/usage.adoc
lib/rubocop/rspec/config_formatter.rb:lib/rubocop/capybara/config_formatter.rb
lib/rubocop/rspec/description_extractor.rb:lib/rubocop/capybara/description_extractor.rb
lib/rubocop/rspec/version.rb:lib/rubocop/capybara/version.rb
lib/rubocop/cop/rspec/mixin/capybara_help.rb:lib/rubocop/cop/capybara/mixin/capybara_help.rb
lib/rubocop/cop/rspec/mixin/css_selector.rb:lib/rubocop/cop/capybara/mixin/css_selector.rb
lib/rubocop/cop/rspec/capybara/current_path_expectation.rb:lib/rubocop/cop/capybara/current_path_expectation.rb
lib/rubocop/cop/rspec/capybara/match_style.rb:lib/rubocop/cop/capybara/match_style.rb
lib/rubocop/cop/rspec/capybara/negation_matcher.rb:lib/rubocop/cop/capybara/negation_matcher.rb
lib/rubocop/cop/rspec/capybara/specific_actions.rb:lib/rubocop/cop/capybara/specific_actions.rb
lib/rubocop/cop/rspec/capybara/specific_finders.rb:lib/rubocop/cop/capybara/specific_finders.rb
lib/rubocop/cop/rspec/capybara/specific_matcher.rb:lib/rubocop/cop/capybara/specific_matcher.rb
lib/rubocop/cop/rspec/capybara/visibility_matcher.rb:lib/rubocop/cop/capybara/visibility_matcher.rb
lib/rubocop/cop/rspec_cops.rb:lib/rubocop/cop/capybara_cops.rb
lib/rubocop-rspec.rb:lib/rubocop-capybara.rb
rubocop-rspec.gemspec:rubocop-capybara.gemspec
spec/project/changelog_spec.rb:spec/project/changelog_spec.rb
spec/project/default_config_spec.rb:spec/project/default_config_spec.rb
spec/rubocop/rspec/config_formatter_spec.rb:spec/rubocop/capybara/config_formatter_spec.rb
spec/rubocop/rspec/description_extractor_spec.rb:spec/rubocop/capybara/description_extractor_spec.rb
spec/rubocop/cop/rspec/capybara/current_path_expectation_spec.rb:spec/rubocop/cop/capybara/current_path_expectation_spec.rb
spec/rubocop/cop/rspec/capybara/match_style_spec.rb:spec/rubocop/cop/capybara/match_style_spec.rb
spec/rubocop/cop/rspec/capybara/negation_matcher_spec.rb:spec/rubocop/cop/capybara/negation_matcher_spec.rb
spec/rubocop/cop/rspec/capybara/specific_actions_spec.rb:spec/rubocop/cop/capybara/specific_actions_spec.rb
spec/rubocop/cop/rspec/capybara/specific_finders_spec.rb:spec/rubocop/cop/capybara/specific_finders_spec.rb
spec/rubocop/cop/rspec/capybara/specific_matcher_spec.rb:spec/rubocop/cop/capybara/specific_matcher_spec.rb
spec/rubocop/cop/rspec/capybara/visibility_matcher_spec.rb:spec/rubocop/cop/capybara/visibility_matcher_spec.rb

I intend to:

  • push master and a branch with an identical PR to rubocop/rubocop-capybara as soon as I have proper permissions to push there
  • publish the gem, and share publish rights with @bquorning, @Darhazer and @ydah
  • ask someone who has permissions to remove/archive this repo

Does it sound like a plan?

Copy link
Member

@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.

Great work @pirj ❤️

Just to double check, the removal of FeatureMethods is intentional, right?

@@ -112,7 +110,7 @@ Layout/LineEndStringConcatenationIndentation:
Style/EmptyHeredoc:
Enabled: true

# Enable our own pending cops.
# Enable pending rubocop-rspec cops.
Copy link
Member

Choose a reason for hiding this comment

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

The .github/PULL_REQUEST_TEMPLATE.md says “[ ] The cop is configured as Enabled: true in .rubocop.yml.” That should probably be removed, as it only applies to RSpec cops.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch 👍

@pirj
Copy link
Collaborator Author

pirj commented Dec 23, 2022

Just to double check, the removal of FeatureMethods is intentional, right?

@bquorning yes, I kept the cop in rubocop-rspec rather than inheriting from rubocop-capybara like other extracted cops in the extraction PR](rubocop/rubocop-rspec#1519). I feel that this cop is RSpec-specific, and we'd better keep it.

@ydah
Copy link
Contributor

ydah commented Dec 27, 2022

[ask] It looks like the following also needs to be corrected, what do you think?

Copyright (c) 2014 Ian MacLeod <ian@nevir.net>

@pirj
Copy link
Collaborator Author

pirj commented Dec 29, 2022

No longer needed, even for history purposes.

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.

None yet

3 participants