rspec/rules/S2933/description.adoc

2 lines
396 B
Plaintext
Raw Normal View History

2021-01-27 13:42:22 +01:00
``++readonly++`` fields can only be assigned in a class constructor. If a class has a field that's not marked ``++readonly++`` but is only set in the constructor, it could cause confusion about the field's intended use. To avoid confusion, such fields should be marked ``++readonly++`` to make their intended use explicit, and to prevent future maintainers from inadvertently changing their use.