[英]Rails rubocop don't indent the block after multiple condition
代码如下所示:
db_table
.where('some condition')
.joins('another table')
.find_each do |table_record|
puts table_record.name
end
是否有 rubocop 规则允许您在do
之后添加缩进?
db_table
.where('some condition')
.joins('another table')
.find_each do |table_record|
puts table_record.name
end
查看 Rubocop 文档,这似乎是您正在寻找的警察:
rubocop.yml 中的这个对我有帮助
Layout/BlockAlignment:
EnforcedStyleAlignWith: start_of_block
它迫使我最后移动end
:
db_table
.where('some condition')
.joins('another table')
.find_each do |table_record|
puts table_record.name
end
然后 rubocop 强制使用缩进
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.