-
-
Notifications
You must be signed in to change notification settings - Fork 58
Fix RuboCop::AST::NumericNode#sign?
to return boolean
#380
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
Fix RuboCop::AST::NumericNode#sign?
to return boolean
#380
Conversation
f6fb9c5
to
ea78ca9
Compare
RuboCop::AST::NumericNode
to return booleanRuboCop::AST::NumericNode#sign?
to return boolean
ea78ca9
to
8b2e4f9
Compare
Can you update specs for diff --git a/spec/rubocop/ast/rational_node_spec.rb b/spec/rubocop/ast/rational_node_spec.rb
index 8e27da8..a253ce3 100644
--- a/spec/rubocop/ast/rational_node_spec.rb
+++ b/spec/rubocop/ast/rational_node_spec.rb
@@ -10,16 +10,18 @@ RSpec.describe RuboCop::AST::RationalNode do
end
describe '#sign?' do
+ subject { rational_node.sign? }
+
context 'when explicit positive rational' do
let(:source) { '+0.2r' }
- it { is_expected.to be_sign }
+ it { is_expected.to be(true) }
end
context 'when explicit negative rational' do
let(:source) { '-0.2r' }
- it { is_expected.to be_sign }
+ it { is_expected.to be(true) }
end
end
|
The documentation states that `sign?` returns boolean: ```ruby def sign? source.match(SIGN_REGEX) end ``` but it does not. Looks like the only usage [1] of `sign?` is this [2] module, so nothing should break. [1] https://github.com/search?q=org%3Arubocop%20sign%3F&type=code [2] https://github.com/rubocop/rubocop/blob/ddbb2a1bb65a29ac2d2d963196f7b00821779fd6/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb#L226 Co-authored-by: Koichi ITO <[email protected]>
8b2e4f9
to
dd235ed
Compare
Sure. Note that either this one or https://github.com/rubocop/rubocop-ast/pull/379/files will have to be updated, depending on the merging order. |
Yeah, I'm aware that #379's specs need to be addressed after this PR is merged. Thank you. |
Sorry for ping @koic, but can we proceed with this one? |
Thanks @viralpraxis. I have a branch that I need to finish and merge that fixes all of the predicates, including matchers... But this can be merged now. Do you need a release for this? |
@marcandre It would be preferable if #379 is included in the next release. |
Thanks @koic . Released as v1.46.0 Please don't hesitate to ping me after a few days, I sometimes miss notifications 😅 |
The documentation states that
sign?
returns boolean:but it does not.
Looks like the only usage [1] of
sign?
is this [2] module, so nothing should break.[1] https://github.com/search?q=org%3Arubocop%20sign%3F&type=code
[2] https://github.com/rubocop/rubocop/blob/ddbb2a1bb65a29ac2d2d963196f7b00821779fd6/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb#L226