Skip to content

Commit

Permalink
statistics-generator: Automatically omit empty sections.
Browse files Browse the repository at this point in the history
Also add some comments to the quite cryptic sed script.

Changelog: None

Signed-off-by: Kristian Amlie <[email protected]>
  • Loading branch information
Kristian Amlie committed Jan 17, 2022
1 parent 0a6cd45 commit 8c0902c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
30 changes: 25 additions & 5 deletions extra/statistics-generator
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,34 @@ collect_changes() {

post_process() {
sed -nre '
:start
# If empty line.
/^$/{
p
# Read next line.
s/$/\n/
N
# This is a new table, add table header.
s/\n([^\n]*)$/| \1 | |/
# Add table separator.
s/$/\n|---|---|/
# Store result for now (do not print yet).
x
# Read next line.
n
s/^(.*)$/| \1 | |/
p
c |---|---|
# If empty, omit the whole section and start over (empty category).
/^$/{
b start
}
# Else recover stored result, print it, and then continue.
x
p
n
x
}
/%/{
s/^(.+)/| \1/
Expand Down
24 changes: 0 additions & 24 deletions extra/test_statistics_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,6 @@ def test_post_process():
| Alf-Rune Siqveland | 78 (2.6%) |
| Peter Grzybowski | 59 (2.0%) |
| Developers with the most lines removed | |
|---|---|
| Developers with the most signoffs (total 0) | |
|---|---|
| Developers with the most reviews (total 0) | |
|---|---|
| Developers with the most test credits (total 0) | |
|---|---|
| Developers who gave the most tested-by credits (total 0) | |
|---|---|
| Developers with the most report credits (total 0) | |
|---|---|
| Developers who gave the most report credits (total 0) | |
|---|---|
| Top changeset contributors by employer | |
|---|---|
| Northern.tech | 91 (89.2%) |
Expand All @@ -80,9 +59,6 @@ def test_post_process():
| Northern.tech | 2302 (76.2%) |
| RnDity | 719 (23.8%) |
| Employers with the most signoffs (total 0) | |
|---|---|
| Employers with the most hackers (total 8) | |
|---|---|
| Northern.tech | 6 (75.0%) |
Expand Down

0 comments on commit 8c0902c

Please sign in to comment.