rake では警告がデフォルトで明らかに無効になっていることを知って驚きました:
def broken_code
path = '/tmp/foo'
# create empty file
File.open(path, 'w')
# when warnings are enabled you get a warning here- File#new does not take a block
File.new(path) do |f|
puts "never get here..."
end
end
task :no_warnings do |t|
broken_code
end
task :warnings do |t|
$VERBOSE = 1
broken_code
end
なぜ彼らは無効になっているのですか?VERBOSE=1
コードの早い段階で設定する以外に、それらを有効にする簡単な方法はありますか?