Skip to content

Commit c76e6ba

Browse files
(#102) Fix list contributors script
1 parent 144cb87 commit c76e6ba

File tree

3 files changed

+23
-57
lines changed

3 files changed

+23
-57
lines changed

contributors.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,17 @@
22

33
This is a list of all the contributors to this repository in ascending order by the contributor name.
44

5-
**Colin Mackay** contributed 86 commits from Friday, 28 January, 2022 @ 22:52:08 +00:00 to Monday, 14 November, 2022 @ 21:28:37 +00:00.
5+
**Colin Mackay** contributed 107 commits from Friday, 28 January, 2022 @ 22:52:08 +00:00 to Monday, 2 December, 2024 @ 22:28:08 +00:00.
66

7-
**dependabot[bot]** contributed 29 commits from Monday, 31 January, 2022 @ 14:31:26 +00:00 to Monday, 14 November, 2022 @ 20:56:14 +00:00.
7+
**dependabot[bot]** contributed 48 commits from Monday, 31 January, 2022 @ 14:31:26 +00:00 to Wednesday, 2 August, 2023 @ 14:17:50 +01:00.
88

9-
**StravaigBot** contributed 4 commits from Thursday, 3 February, 2022 @ 12:20:25 +00:00 to Wednesday, 9 February, 2022 @ 22:29:07 +00:00.
9+
**StravaigBot** contributed 5 commits from Thursday, 3 February, 2022 @ 12:20:25 +00:00 to Monday, 14 November, 2022 @ 21:56:12 +00:00.
1010

1111
## Summary
1212

13-
:octocat: 119 commits in total.
13+
:octocat: 160 commits in total.
1414

1515
:date: From Friday, 28 January, 2022 @ 22:52:08 +00:00.
1616

17-
:date: Until Monday, 14 November, 2022 @ 21:28:37 +00:00.
18-
19-
:1st_place_medal: Gold medal to Colin Mackay with 86 commits which represents 72.27 % of all commits.
20-
21-
:2nd_place_medal: Silver medal to dependabot[bot] with 29 commits which represents 24.37 % of all commits.
22-
23-
:3rd_place_medal: Bronze medal to StravaigBot with 4 commits which represents 3.36 % of all commits.
17+
:date: Until Monday, 2 December, 2024 @ 22:28:08 +00:00.
2418

list-contributors.ps1

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function Get-IgnoredNamesList($IgnoredNamesPath, $AkaContributors)
101101
}
102102
}
103103

104-
$IgnoredNamesPath = Get-ConfigFilePath -configFilePath $IgnoredNamesPath -defaultConfigFilePath "$PSScriptRoot/.stravaig/list-contributor-ignore-names.txt" -friendlyName "list of ignored names";
104+
$IgnoredNamesPath = Get-ConfigFilePath -configFilePath $IgnoredNamesPath -defaultConfigFilePath "$PSScriptRoot/.stravaig/list-contributor-ignore-names.txt" -friendlyName "list of ignored names";
105105
if ($null -ne $IgnoredNamesPath)
106106
{
107107
$ignoredNames = Get-Content -Path $IgnoredNamesPath;
@@ -156,8 +156,8 @@ function Get-InitialContributors($AkaFilePath)
156156
}
157157
catch
158158
{
159-
# For some reason it isn't stopping the script when erroring with
160-
# -ErrorAction Stop in the ConvertFrom-Json
159+
# For some reason it isn't stopping the script when erroring with
160+
# -ErrorAction Stop in the ConvertFrom-Json
161161
throw $_
162162
}
163163

@@ -218,7 +218,7 @@ function Get-InitialContributors($AkaFilePath)
218218
$contributors = Get-InitialContributors -AkaFilePath $AkaFilePath;
219219
$ignoredNamesList = Get-IgnoredNamesList -IgnoredNamesPath $IgnoredNamesPath -AkaContributors $contributors
220220
$ignoredEmailsList = Get-IgnoredEmailsList -IgnoredEmailsPath $IgnoredEmailsPath -AkaContributors $contributors
221-
& git log --format="\`"%ai\`",\`"%an\`",\`"%ae\`",\`"%H\`"" > raw-contributors.csv
221+
& git log --format="`"%ai`",`"%an`",`"%ae`",`"%H`"" > raw-contributors.csv
222222
$commits = Import-Csv raw-contributors.csv -Header Time,Name,Email,Hash | Sort-Object Time;
223223
Remove-Item .\raw-contributors.csv
224224

@@ -241,9 +241,9 @@ for($i = 0; $i -lt $totalCommits; $i++)
241241
$contributor = New-Object -TypeName PSObject -Property @{
242242
Names=@($nextCommit.Name);
243243
PrimaryName = $nextCommit.Name;
244-
Emails=@($nextCommit.Email);
245-
FirstCommit=$commitTime;
246-
LastCommit=$commitTime;
244+
Emails=@($nextCommit.Email);
245+
FirstCommit=$commitTime;
246+
LastCommit=$commitTime;
247247
CommitCount=1
248248
};
249249
$contributors += $contributor;
@@ -252,13 +252,13 @@ for($i = 0; $i -lt $totalCommits; $i++)
252252
}
253253
else
254254
{
255-
if ((-not(Test-IgnoredItem -Item $nextCommit.Email -IgnoredItemsList $ignoredEmailsList)) -and
255+
if ((-not(Test-IgnoredItem -Item $nextCommit.Email -IgnoredItemsList $ignoredEmailsList)) -and
256256
(-not (Test-Email -Contributor $contributor -CommitterEmail $nextCommit.Email)))
257257
{
258258
Write-Verbose "Adding email `"$($nextCommit.Email)`" to $($contributor.PrimaryName) from commit $($nextCommit.Hash)."
259259
$contributor.Emails += $nextCommit.Email;
260260
}
261-
if ((-not(Test-IgnoredItem -Item $nextCommit.Name -IgnoredItemsList $ignoredNamesList)) -and
261+
if ((-not(Test-IgnoredItem -Item $nextCommit.Name -IgnoredItemsList $ignoredNamesList)) -and
262262
(-not (Test-Name -Contributor $contributor -CommitterName $nextCommit.Name)))
263263
{
264264
Write-Verbose "Adding name `"$($nextCommit.Name)`" to $($contributor.PrimaryName) from commit $($nextCommit.Hash)."
@@ -282,20 +282,20 @@ $contributors = $contributors | Where-Object CommitCount -gt 0
282282
$isDescending = $SortDirection -eq "Descending";
283283
Switch($SortOrder)
284284
{
285-
"Name" {
285+
"Name" {
286286
$contributors = $contributors | Sort-Object PrimaryName -Descending:$isDescending;
287287
$textOrderBy = "contributor name";
288288
}
289289
"FirstCommit" {
290-
$contributors = $contributors | Sort-Object FirstCommit -Descending:$isDescending;
290+
$contributors = $contributors | Sort-Object FirstCommit -Descending:$isDescending;
291291
$textOrderBy = "first commit date";
292292
}
293293
"LastCommit" {
294-
$contributors = $contributors | Sort-Object LastCommit -Descending:$isDescending;
294+
$contributors = $contributors | Sort-Object LastCommit -Descending:$isDescending;
295295
$textOrderBy = "last commit date";
296296
}
297297
"CommitCount" {
298-
$contributors = $contributors | Sort-Object CommitCount -Descending:$isDescending;
298+
$contributors = $contributors | Sort-Object CommitCount -Descending:$isDescending;
299299
$textOrderBy = "number of commits";
300300
}
301301
}
@@ -331,14 +331,14 @@ foreach($contributor in $contributors)
331331
$end = $contributor.LastCommit.ToString($TimeFormat);
332332
}
333333
else {
334-
$end = $contributor.LastCommit.ToString($DateTimeFormat);
334+
$end = $contributor.LastCommit.ToString($DateTimeFormat);
335335
}
336336
"**$name**$aka contributed $numCommits $commitMsg" | Out-File $OutputFile -Append -Encoding utf8 -NoNewline
337337
if ($numCommits -eq 1)
338338
{
339339
" on $start." | Out-File $OutputFile -Append -Encoding utf8
340340
}
341-
else
341+
else
342342
{
343343
" from $start to $end." | Out-File $OutputFile -Append -Encoding utf8
344344
}
@@ -348,42 +348,13 @@ foreach($contributor in $contributors)
348348
"" | Out-File $OutputFile -Append -Encoding utf8
349349

350350
$firstCommit = $commits[0];
351-
$firstCommitMsg = [DateTime]::ParseExact($firstCommit.Time, "yyyy-MM-dd HH:mm:ss zzz", [CultureInfo]::InvariantCulture).ToString($DateTimeFormat);
351+
$firstCommitMsg = [DateTime]::ParseExact($firstCommit.Time, "yyyy-MM-dd HH:mm:ss zzz", [CultureInfo]::InvariantCulture).ToString($DateTimeFormat);
352352
$lastCommit = $commits[$totalCommits - 1];
353-
$lastCommitMsg = [DateTime]::ParseExact($lastCommit.Time, "yyyy-MM-dd HH:mm:ss zzz", [CultureInfo]::InvariantCulture).ToString($DateTimeFormat);
353+
$lastCommitMsg = [DateTime]::ParseExact($lastCommit.Time, "yyyy-MM-dd HH:mm:ss zzz", [CultureInfo]::InvariantCulture).ToString($DateTimeFormat);
354354

355355
":octocat: $totalCommits commits in total." | Out-File $OutputFile -Append -Encoding utf8
356356
"" | Out-File $OutputFile -Append -Encoding utf8
357357
":date: From $firstCommitMsg." | Out-File $OutputFile -Append -Encoding utf8
358358
"" | Out-File $OutputFile -Append -Encoding utf8
359359
":date: Until $lastCommitMsg." | Out-File $OutputFile -Append -Encoding utf8
360360
"" | Out-File $OutputFile -Append -Encoding utf8
361-
362-
$topCommitters = ($contributors | Sort-Object CommitCount -Descending);
363-
$topCommitter = $topCommitters[0];
364-
$name = $topCommitter.PrimaryName;
365-
$commitCount = $topCommitter.CommitCount;
366-
$percentage = $topCommitter.CommitCount / $totalCommits;
367-
368-
":1st_place_medal: Gold medal to $name with $commitCount commits which represents "+("{0:P2}" -f $percentage)+" of all commits." | Out-File $OutputFile -Append -Encoding utf8
369-
"" | Out-File $OutputFile -Append -Encoding utf8
370-
371-
$topCommitter = $topCommitters[1];
372-
if ($null -ne $topCommitter)
373-
{
374-
$name = $topCommitter.PrimaryName;
375-
$commitCount = $topCommitter.CommitCount;
376-
$percentage = $topCommitter.CommitCount / $totalCommits;
377-
":2nd_place_medal: Silver medal to $name with $commitCount commits which represents "+("{0:P2}" -f $percentage)+" of all commits." | Out-File $OutputFile -Append -Encoding utf8
378-
"" | Out-File $OutputFile -Append -Encoding utf8
379-
}
380-
381-
$topCommitter = $topCommitters[2];
382-
if ($null -ne $topCommitter)
383-
{
384-
$name = $topCommitter.PrimaryName;
385-
$commitCount = $topCommitter.CommitCount;
386-
$percentage = $topCommitter.CommitCount / $totalCommits;
387-
":3rd_place_medal: Bronze medal to $name with $commitCount commits which represents "+("{0:P2}" -f $percentage)+" of all commits." | Out-File $OutputFile -Append -Encoding utf8
388-
"" | Out-File $OutputFile -Append -Encoding utf8
389-
}

src/Stravaig.Configuration.SqlServer.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "__BuildAndDeploy", "__Build
1212
..\Reset-WipReleaseNotes.ps1 = ..\Reset-WipReleaseNotes.ps1
1313
..\Set-Version.ps1 = ..\Set-Version.ps1
1414
..\version.txt = ..\version.txt
15+
..\list-contributors.ps1 = ..\list-contributors.ps1
1516
EndProjectSection
1617
EndProject
1718
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "__Documentation", "__Documentation", "{61C05782-A253-4EDD-9463-04912EB73870}"

0 commit comments

Comments
 (0)