-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
bugfix: Fix potential NME when converting ParameterType to envelope #1789
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
base: main
Are you sure you want to change the base?
bugfix: Fix potential NME when converting ParameterType to envelope #1789
Conversation
@luke-hill relatively straight-forward fix, although I'm not super pleased with the rspec test due to the method of interest being private. I don't think this warrants an update to any of the features since it's an admittedly weird way to declare a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I agree on no source location being provided when a bound method. because it still exists there.
But I've not dug into it in more detail
Also we need to keep the contract up. I might ask how the other flavours deal with it
@@ -30,6 +30,7 @@ refactored to use newer, less procedural ruby_) | |||
- Fixed an issue where a change to one example in compatibility testing wasn't fully adhered to ([luke-hill](https://github.com/luke-hill)) | |||
- Fixed Ruby 3.4+ issue where error backtraces weren't being formatted. ([#1771](https://github.com/cucumber/cucumber-ruby/pull/1771) [orien](https://github.com/orien)) | |||
- Fix some problematic specs that were leaking state and showcasing an issue on JRuby ([#1783](https://github.com/cucumber/cucumber-ruby/pull/1783) [luke-hill](https://github.com/luke-hill)) | |||
- Fixed an issue where NoMethodError could be raised when declaring a parameter-type that used bound methods ([#1789](https://github.com/cucumber/cucumber-ruby/pull/1789)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will conflict soon as I'm about to cut v10. I will happily cut another v10.0.1 soon after if desired
let(:prefer_for_regexp_match) { true } | ||
|
||
before do | ||
allow(configuration).to receive_message_chain(:id_generator, :new_id).and_return(id) # rubocop:disable RSpec/MessageChain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to remove inline stuff, I don't mind it being added to the overall directive to be fixed up at a later date or if you can tackle it here that would be good
regular_expressions: [%("[^"]+")], | ||
prefer_for_regular_expression_match: true, | ||
use_for_snippets: false, | ||
source_reference: anything # tested in later cases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid cop offenses can this be returned as something like :no_op
FYI I just encountered this at my job today. We used a lambda autofix from rubocop |
end | ||
|
||
context 'when provided a ParameterType with transformer being a lambda' do | ||
let(:transformer) { ->(s) { s } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is autocorrected via rubocop to lambda(&:to_s) as an example
Few style tweaks but other than that this is good to merge soon @mitchgrout |
Description
Sets
source_reference
tonil
if the parameter type transformer does not provide a valid source location, i.e. isnil
.Fixes #1788
Type of change
Bug fix (non-breaking change which fixes an issue)
Checklist:
Your PR is ready for review once the following checklist is
complete. You can also add some checks if you want to.
bundle exec rubocop
reports no offenses