Skip to content

Instantly share code, notes, and snippets.

@motine
Created February 4, 2019 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motine/2753cf33d67dcc30789495166658f9e3 to your computer and use it in GitHub Desktop.
Save motine/2753cf33d67dcc30789495166658f9e3 to your computer and use it in GitHub Desktop.
BASE_PATH = File.expand_path("~/Repositories/beauty")
LINE_LENGTH_THRESHOLD = 150
above, total = 0, 0
Dir[File.join(BASE_PATH, "**/*.rb")].each do |path|
contents = File.readlines(path)
above += contents.count { |line| line.length > LINE_LENGTH_THRESHOLD }
total += contents.size
end
puts "There are #{above}/#{total} (#{(above.to_f / total * 100).round(2)}%) lines above #{LINE_LENGTH_THRESHOLD} characters"
# There are 1366/13052 (10.47%) lines above 80 characters
# There are 314/13052 (2.41%) lines above 120 characters
# There are 120/13052 (0.92%) lines above 150 characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment