diff --git a/lib/overcommit/hook/pre_commit/line_endings.rb b/lib/overcommit/hook/pre_commit/line_endings.rb index ab66001b..95b7cbbb 100644 --- a/lib/overcommit/hook/pre_commit/line_endings.rb +++ b/lib/overcommit/hook/pre_commit/line_endings.rb @@ -9,8 +9,7 @@ def run messages = [] offending_files.map do |file_name| - file = File.open(file_name) - begin + File.open(file_name) do |file| messages += check_file(file, file_name) rescue ArgumentError => e # File is likely a binary file which this check should ignore, but