Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 22 lines (20 sloc) 0.499 kB
#!/usr/bin/env ruby
#
# Usage: nsloc {FILE|GLOB}...
#
# Reports the number of source lines of code (nsloc) for each globbed file.
#
# Written in 2012 by Suraj N. Kurapati <https://github.com/sunaku>
total = 0
require 'coverage'
Coverage.start
files = Dir[*ARGV].each {|f| load f }
cover = Coverage.result.map do |file, hits|
if files.include? file
[hits.reject(&:nil?).size, file]
end
end.compact.sort_by(&:first).map do |line|
total += line.first
line.join("\t")
end
puts cover, total
Jump to Line
Something went wrong with that request. Please try again.