You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.3 KiB
34 lines
1.3 KiB
#!/bin/bash
|
|
|
|
echo "Requirements:"
|
|
echo -e "\tAt least 200 commits"
|
|
echo -e "\tAt least 50 commits per user"
|
|
echo -e "\tAt least 20% test commits per user"
|
|
echo -e "\tAt least 20% refactoring commits per user"
|
|
echo
|
|
|
|
echo "Total commits: $(git shortlog -s -n --no-merges | awk '{ sum += $1; } END { print sum; }' "$@")"
|
|
|
|
echo "Commits per user:"
|
|
for user in $(git shortlog -s | awk '{ print $2 }'); do
|
|
email=$(git shortlog -s -e --author="$user" | sed 's/<//;s/>//' | awk '{ print $3 }')
|
|
total_commits=$(git shortlog -s --no-merges --perl-regexp --author="$user" | awk '{ print $1 }')
|
|
test_commits=$(git shortlog -s --perl-regexp --author="$user" --grep='^test:' | awk '{ print $1 }')
|
|
refactor_commits=$(git shortlog -s --perl-regexp --author="$user" --grep='^refactoring:' | awk '{ print $1 }')
|
|
|
|
if [[ $test_commits -eq 0 ]]; then
|
|
test_commits=0
|
|
test_percentage=0
|
|
else
|
|
test_percentage=$(echo "$test_commits/$total_commits*100" | bc -l | xargs printf "%.2f")
|
|
fi
|
|
|
|
if [[ $refactor_commits -eq 0 ]]; then
|
|
refactor_commits=0
|
|
refactor_percentage=0
|
|
else
|
|
refactor_percentage=$(echo "$refactor_commits/$total_commits*100" | bc -l | xargs printf "%.2f")
|
|
fi
|
|
|
|
echo -e "\t$user ($email): Total $total_commits, Tests: $test_commits ($test_percentage%), Refactorings: $refactor_commits ($refactor_percentage%)"
|
|
done
|