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

Use single quotes in generated template steps #1323

Merged
merged 1 commit into from
Oct 29, 2018

Conversation

acant
Copy link
Contributor

@acant acant commented Oct 27, 2018

Summary

Update the missing step generation template to use single-quotes for strings instead of double-quotes.

Details

When pending steps are generated for undefined steps, the step name does
not include any interpolation so double-quotes are not necessary. Only
the single-quotes are necessary for those strings.

This will make the generated steps allow consistent with the ruby style guide:
https://github.com/rubocop-hq/ruby-style-guide#strings

And with the default settings for Rubocop Style/StringLiterals cop:
https://github.com/rubocop-hq/rubocop/blob/ab6346ed37d88a4b900c96979f8ef18959e8dcce/lib/rubocop/cop/style/string_literals.rb

Motivation and Context

This will make it easier to use the generated steps, in a project using Rubocop, by making those steps already back the default Rubocop rules.

How Has This Been Tested?

I have updated the existing cucumber and rspec tests for the step generation.

Types of changes

  • Refactor (code change that does not change external functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I've added tests for my code
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Thank you to everyone who works on cucumber. I use in in my work and personal projects, and I am very grateful that it exists!
This is my first PR to a cucumber repo, so if there is anything that I got wrong, or can do to make it easier to merge, please let me know and I will try to update it quickly.

@acant
Copy link
Contributor Author

acant commented Oct 27, 2018

Looks like I missed some of the cucumber steps which effect my change. I will updated those.

I also see that there is an error in some of the ruby version with the google-protobuf gem, which I think is a dependency through cucumber-messages? If I am reading that correctly. I will try to investigate, and at least give a link if there is already an issue opened for it.

@acant acant changed the title Use single updates in generated template steps Use single quotes in generated template steps Oct 28, 2018
When pending steps are generated for undefined steps, the step name does
not include any interpolation so double-quotes are not necessary. Only
the single-quotes are necessary for those strings.

This will make the generated steps allow consistent with the ruby style
guide:
  https://github.com/rubocop-hq/ruby-style-guide#strings

And with the default settings for Rubocop Style/StringLiterals cop:
  https://github.com/rubocop-hq/rubocop/blob/ab6346ed37d88a4b900c96979f8ef18959e8dcce/lib/rubocop/cop/style/string_literals.rb
@acant
Copy link
Contributor Author

acant commented Oct 28, 2018

I think that I have fixed the errors related to my changes, and the test seem to be green on all the ruby versions.

It appears that the jruby test is failing to install google-protbuf, probably because of this issue
protocolbuffers/protobuf#1594
which is old and has not been resolved.
And appvevyor, has similar problems with its environment.

@aslakhellesoy
Copy link
Contributor

I think this PR also fixes #1291 which has been open for a while!

@aslakhellesoy
Copy link
Contributor

LGTM! The other build errors are unrelated - sorry about that.

@xtrasimplicity xtrasimplicity merged commit 328b785 into cucumber:master Oct 29, 2018
@aslakhellesoy
Copy link
Contributor

Hi @acant,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants