简体   繁体   中英

Remove writable attribute warning - Reek

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM