helper for getting lines of code stats

This commit is contained in:
Morgan Wattiez 2019-10-22 07:57:44 +02:00
parent c67c076d89
commit 0058e33cdb

View File

@ -116,17 +116,30 @@ function skip {
cut -d' ' -f$n-
}
# Unique lines of code
# Via https://text.causal.agency/004-uloc.txt
function uloc {
find . -type f \( \
cmd_loc="find . -type f \( \
-name '*.py' \
-o -name '*.rb' \
-o -name '*.go' \
-o -name '*.java' \
-o -name '*.c' -o -name '*.h' \
-o -name '*.js' \
\) -exec \cat \{\} \; | sed -e 's/^[ \t]*//;s/[ \t]*$//' | sort -u | wc -l
-o -name '*.tsx' \
-o -name '*.md' \
-o -name '*.xml' \
-o -name '*.groovy' \
-o -name '*.gradle' \
-o -name '*.properties' \
\) -exec \cat \{\} \; | LANG=C LC_CTYPE=C sed -e 's/^[ \t]*//;s/[ \t]*$//'"
# Unique lines of code
# Via https://text.causal.agency/004-uloc.txt
function uloc {
eval "$cmd_loc | LANG=C LC_CTYPE=C sort -u | wc -l"
}
# Top lines of code
function toploc {
eval "$cmd_loc | cut -c 1-100 | LANG=C LC_CTYPE=C sort | uniq -c | sort -nr"
}
# Find files bigger than X size and sort them by size