I would like to get RuboCop to enforce a style like this:
# bad
alias_method :pharmacy, :recipient
alias_method :pharmacy=, :recipient=
before_save -> do
self.label = "Prescription" if label.blank?
end
before_save -> do
self.recipient ||= appointment.patient.pharmacy
end
# good
alias_method :pharmacy, :recipient
alias_method :pharmacy=, :recipient=
before_save -> do
self.label = "Prescription" if label.blank?
end
before_save -> do
self.recipient ||= appointment.patient.pharmacy
end
Is this possible?
Yes, it is possible.
There is a way to extend the Rubocop rule set by using extensions
https://docs.rubocop.org/rubocop/extensions.html.