Skip to content

Commit 1aa8790

Browse files
committed
Use File.foreach to count lines rather than File#each_line
1 parent 30f9869 commit 1aa8790

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/overcommit/hook_context/run_all.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ def hook_script_name
3535
private
3636

3737
def count_lines(file)
38-
num_lines = 0
39-
File.new(file).each_line { num_lines += 1 }
40-
num_lines
38+
File.foreach(file).count
4139
end
4240
end
4341
end

0 commit comments

Comments
 (0)