Remove writable attribute warning - Reek

830 Views Asked by At

The model is defined as follows

attr_accessor :delay_type, :stop_type

This raises the following warning by reek

Order#stop_type is a writable attribute

Any idea on how to fix this?

1

There are 1 best solutions below

0
On

attr_accessor creates both attr_reader and attr_writer.

You have created both but you are not using the writer so reek is raising a warning that you have extra code that is not being used.

You should either ignore the warning if you will use the writer later or do this:

attr_accessor :delay_type
attr_reader :stop_type