Closed rzane closed 1 year ago
@rzane though you may want to increment the version number if you want a new release out after this merges.
@smudge, not sure what's going on, but I don't see a merge button. I'm guessing I don't have permission?
@rzane @smudge This change breaks on empty classes:
class MyClass
end
NoMethodError:
undefined method `begin_type?' for nil:NilClass
# ./lib/rubocop/cop/betterment/active_job_performable.rb:39:in `possible_methods_within'
# ./lib/rubocop/cop/betterment/active_job_performable.rb:35:in `has_perform_method?'
# ./lib/rubocop/cop/betterment/active_job_performable.rb:27:in `on_class'
nody.body
is nil in this case. return [] if node.body.nil?
at the beginning of possible_methods_within
will fix it.
Ah! Thank you @aburgel! I'll fix this right away!
The following code was incorrectly being recognized as an offense:
This was happening because
Node#descendants
returns all of the nodes descendants (recursively), rather than the node's immediate children.