Created
February 4, 2019 16:01
-
-
Save motine/2753cf33d67dcc30789495166658f9e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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