Ruby

Ruby

Made by DeepSource

A block can be used that cleans up resources automatically on closing RB-ST1007

Style
Major

A block accepting version of the method can be used that does automatic resource cleanup.

Bad practice

f = File.open('file')

Recommended

File.open('file') do |f|
  # ...
end