mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #20263 from arunagw/aa-remove-custom-lines-actionview
Remove custom `lines` and use `/tools/line_statistics`
This commit is contained in:
commit
be18476fb2
1 changed files with 3 additions and 21 deletions
|
@ -52,25 +52,7 @@ Gem::PackageTask.new(spec) do |p|
|
||||||
end
|
end
|
||||||
|
|
||||||
task :lines do
|
task :lines do
|
||||||
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
|
load File.expand_path('..', File.dirname(__FILE__)) + '/tools/line_statistics'
|
||||||
|
files = FileList["lib/**/*.rb"]
|
||||||
FileList["lib/**/*.rb"].each do |file_name|
|
CodeTools::LineStatistics.new(files).print_loc
|
||||||
next if file_name =~ /vendor/
|
|
||||||
File.open(file_name, 'r') do |f|
|
|
||||||
while line = f.gets
|
|
||||||
lines += 1
|
|
||||||
next if line =~ /^\s*$/
|
|
||||||
next if line =~ /^\s*#/
|
|
||||||
codelines += 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
|
|
||||||
|
|
||||||
total_lines += lines
|
|
||||||
total_codelines += codelines
|
|
||||||
|
|
||||||
lines, codelines = 0, 0
|
|
||||||
end
|
|
||||||
|
|
||||||
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue