-
Notifications
You must be signed in to change notification settings - Fork 552
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
Deprecate default check #626
Conversation
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.
left you a couple comments, rest of the code looks good 👍
lib/thor/parser/option.rb
Outdated
raise ArgumentError, err | ||
elsif @check_default_type == nil | ||
Thor.deprecation_warning "#{err}.\n" + | ||
'This will be rejected in the future unless you explicitly pass the options `check_default_type: false`.' |
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'd rephrase that as:
'This will be rejected in the future unless you explicitly pass the options `check_default_type: false` or define `allow_incompatible_default_type!` in your code'
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.
As above, but "or callallow_..."
spec/thor_spec.rb
Outdated
it "allows incompatible types if `check_default_type: false` is given" do | ||
expect do | ||
Class.new(Thor) do | ||
allow_incompatible_default_type! |
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.
Remove this line so the second test makes sense (else it's equivalent to the previous one)
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.
Oops, indeed. And it revealed a bug that was already there whereby an explicit setting was always overwritten by a merge being inverted. Fixed
c15c5c6
to
4fb8401
Compare
This reverts commit a88ea56792c9a40d803f025ffcb63e8ae35bf5ff.
…cit option given [rails#621]
4fb8401
to
7d199c0
Compare
This issues a deprecation warning if one specifies an incompatible default value without either calling
allow_incompatible_default_type!
or passingcheck_default_type: false
.See discussion in #621