Skip to content

Instantly share code, notes, and snippets.

@byroot
Created December 19, 2024 08:06
Show Gist options
  • Save byroot/87235e9c2553aacd36c31b1f16e81b84 to your computer and use it in GitHub Desktop.
Save byroot/87235e9c2553aacd36c31b1f16e81b84 to your computer and use it in GitHub Desktop.
src_count = frozen_src_count = 0
ARGV.each do |gem_path|
Dir.glob(File.join(gem_path, "**/*.rb")) do |file|
next unless File.file?(file) && File.readable?(file)
src_count += 1
frozen_src_count += 1 if File.binread(file) =~ /^# frozen[-_]string[-_]literal: (true|false)$/
end
end
puts "total files: #{src_count}"
puts "files with comment: #{frozen_src_count}"
puts "rate #{((frozen_src_count.to_f / src_count) * 100).round(1)}%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment