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

Dependency Update / Ruby Syntax overhaul #441

Merged
merged 8 commits into from
Nov 28, 2019

Conversation

luke-hill
Copy link
Contributor

Summary

This PR fixes a couple of small syntax issues, it adds a new core-dependency (Which simplifies a lot of logic and doesn't really change XP)

Details

  • Remove some conditional hooks, that aren't needed
  • Use Better Ruby Syntax

Motivation and Context

Remove un-needed lines of code. Simplify contributor block

How Has This Been Tested?

CI

Screenshots (if appropriate):

Types of changes

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

…build based on changes made in 5df9101#diff-9eec7a23bd3ec4020b3ff843a87c0e4a

As the build was never broken, one can only assume the changes made at the time were based on an understanding Rails 5.1 did 'something' which in fact it didn't.

I've removed this logic but left the two sanitizer methods with a comment. These can be removed in cucumber-rails 2.1 if no further issues are detected. However it could be that this might raise an issue. However as this is only internal testing code, any issues should be negligible.

Obviously as this suite is reasonably old and used in a variety of places, there could be issues. In which case reverting this commit would suffice. However, this should not be necessary as the code should never work (Modifying frozen strings)

On-top of this, a minor refactor has been made to use better syntax for the auto-generated files (Later Ruby syntax)
@luke-hill luke-hill force-pushed the refactor/ruby_syntax_update branch from f84ee56 to 5fd50b6 Compare August 27, 2019 09:13
gem_regexp = /gem ["']#{name}["'].*$/
gemfile_content = File.read(expand_path('Gemfile'))
puts "Frozen status of gem_regexp #{gem_regexp.frozen?}"
puts "Frozen status of gemfile_content #{gemfile_content.frozen?}"

Choose a reason for hiding this comment

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

Suggested change
puts "Frozen status of gemfile_content #{gemfile_content.frozen?}"
puts "Frozen status of gemfile_content: #{gemfile_content.frozen?}"

gem_regexp = /gem ["']#{name}["'].*$/
gemfile_content = File.read(expand_path('Gemfile'))
puts "Frozen status of gem_regexp #{gem_regexp.frozen?}"

Choose a reason for hiding this comment

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

Maybe this is a nitpick, but I think this message would be clearer if there were a colon:

Suggested change
puts "Frozen status of gem_regexp #{gem_regexp.frozen?}"
puts "Frozen status of gem_regexp #{gem_regexp.frozen?}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not planning on committing this. It's more for my benefit.

This code "should not" work

@@ -46,7 +47,7 @@ Feature: Allow Cucumber to rescue exceptions
Scenario: Don't allow rescue
When I write to "features/posts.feature" with:
"""
Feature: posts
Feature: Posts

Choose a reason for hiding this comment

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

I am very appreciative of this sort of change.

…editors or code-reviewers

This was because we were mutating frozen strings but in a different thread which didn't adhere to Rubys magic comment.
@luke-hill
Copy link
Contributor Author

Ping for review.

In essence

  • Fix syntax to new symbol push syntax (not rockets)
  • Fix a bug which isn't an issue yet, but could be an issue in Ruby3 or 2.7 (Where we're mutating a frozen string, but inside a different thread where magic comments don't work)
  • Remove condition gem assign which isn't needed

@luke-hill luke-hill merged commit a33bf05 into master Nov 28, 2019
@luke-hill luke-hill deleted the refactor/ruby_syntax_update branch November 28, 2019 10:13
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.

2 participants