| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # Script that displays some interesting stats about the gitlint project (LOC, # commits, downloads, etc) |
| 3 | |
| 4 | BLUE="\033[94m" |
| 5 | NO_COLOR="\033[0m" |
| 6 | |
| 7 | titlescip-shell shell shell-project 0.0.0 title().(){ |
| 8 | echoscip-shell system . . echo. -e "$BLUE=== $1 ===$NO_COLOR" |
| 9 | } |
| 10 | |
| 11 | titlescip-shell shell shell-project 0.0.0 title(). Code |
| 12 | radon raw -s gitlint-core | tailscip-shell system . . tail. -n 11 | sedscip-shell system . . sed. 's/^ //' |
| 13 | |
| 14 | titlescip-shell shell shell-project 0.0.0 title(). Docs |
| 15 | echoscip-shell system . . echo. "Markdown: $(catscip-shell system . . cat. docs/*.md | wcscip-shell system . . wc. -l | trscip-shell system . . tr. -d " ") lines" |
| 16 | |
| 17 | titlescip-shell shell shell-project 0.0.0 title(). Tests |
| 18 | nr_unit_tests=$(py.test gitlint-core/ --collect-only | grepscip-shell system . . grep. TestCaseFunction | wcscip-shell system . . wc. -l) |
| 19 | nr_integration_tests=$(py.test qa/ --collect-only | grepscip-shell system . . grep. TestCaseFunction | wcscip-shell system . . wc. -l) |
| 20 | echoscip-shell system . . echo. "Unit Tests: ${nr_unit_tests//[[:space:]]/}" |
| 21 | echoscip-shell system . . echo. "Integration Tests: ${nr_integration_tests//[[:space:]]/}" |
| 22 | |
| 23 | titlescip-shell shell shell-project 0.0.0 title(). Git |
| 24 | echoscip-shell system . . echo. "Commits: $(gitscip-shell system . . git. rev-list --all --count)" |
| 25 | echoscip-shell system . . echo. "Commits (main): $(gitscip-shell system . . git. rev-list main --count)" |
| 26 | echoscip-shell system . . echo. "First commit: $(gitscip-shell system . . git. log --pretty="%aD" $(gitscip-shell system . . git. rev-list --max-parents=0 HEAD))" |
| 27 | echoscip-shell system . . echo. "Contributors: $(gitscip-shell system . . git. log --format='%aN' | sortscip-shell system . . sort. -u | wcscip-shell system . . wc. -l | trscip-shell system . . tr. -d ' ')" |
| 28 | echoscip-shell system . . echo. "Releases (tags): $(gitscip-shell system . . git. tag --list | wcscip-shell system . . wc. -l | trscip-shell system . . tr. -d ' ')" |
| 29 | latest_tag=$(gitscip-shell system . . git. tag --sort=creatordate | tailscip-shell system . . tail. -n 1) |
| 30 | echoscip-shell system . . echo. "Latest Release (tag): $latest_tag" |
| 31 | echoscip-shell system . . echo. "Commits since $latest_tag: $(gitscip-shell system . . git. log --format=oneline HEAD...$latest_tag | wcscip-shell system . . wc. -l | trscip-shell system . . tr. -d ' ')" |
| 32 | echoscip-shell system . . echo. "Line changes since $latest_tag: $(gitscip-shell system . . git. diff --shortstat $latest_tag)" |
| 33 | |
| 34 | # PyPi API: https://pypistats.org/api/ |
| 35 | titlescip-shell shell shell-project 0.0.0 title(). PyPi |
| 36 | info=$(curlscip-shell system . . curl. -Ls https://pypi.python.org/pypi/gitlint/json) |
| 37 | echoscip-shell system . . echo. "Current version: $(echoscip-shell system . . echo. $info | jqscip-shell system . . jq. -r .info.version)" |
| 38 | |
| 39 | titlescip-shell shell shell-project 0.0.0 title(). "PyPI (Downloads)" |
| 40 | overall_stats=$(curlscip-shell system . . curl. -s https://pypistats.org/api/packages/gitlint/overall) |
| 41 | recent_stats=$(curlscip-shell system . . curl. -s https://pypistats.org/api/packages/gitlint/recent) |
| 42 | echoscip-shell system . . echo. "Last 6 Months: $(echoscip-shell system . . echo. $overall_stats | jqscip-shell system . . jq. -r '.data[].downloads' | awkscip-shell system . . awk. '{sum+=$1} END {print sum}')" |
| 43 | echoscip-shell system . . echo. "Last Month: $(echoscip-shell system . . echo. $recent_stats | jqscip-shell system . . jq. .data.last_month)" |
| 44 | echoscip-shell system . . echo. "Last Week: $(echoscip-shell system . . echo. $recent_stats | jqscip-shell system . . jq. .data.last_week)" |
| 45 | echoscip-shell system . . echo. "Last Day: $(echoscip-shell system . . echo. $recent_stats | jqscip-shell system . . jq. .data.last_day)" |