t6d / smart_properties

Ruby accessors on steroids
MIT License
177 stars 20 forks source link

WIP Add rubocop cop to watch for risky defaults. #65

Closed alexaitken closed 3 years ago

alexaitken commented 6 years ago

working through what to add to check

require:
  - rubocop-smart_properties

SmartProperties/DefaultsPerInstance:
  Enabled: true

@t6d

t6d commented 6 years ago

If an object implements #to_proc, SmartProperties will invoke the method instead of using the object as a default itself. Looking at the code, I'm assuming this would incorrectly be flagged as mutable. Any ideas how we could prevent that?