Skip to content

Commit

Permalink
fix: Sort file paths in CSV export
Browse files Browse the repository at this point in the history
One last bit of sorting required for the CSV export to consistently export the same way every time.
  • Loading branch information
thehale committed Nov 10, 2024
1 parent 2c125ba commit 325cb9e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion git_authorship/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def as_csv(
with io_handle(output) as f:
writer = csv.writer(f)
writer.writerow(["path", "author", "lines"])
for path, authors in authorship.items():
for path, authors in sorted(authorship.items(), key=lambda x: x[0]):
for author, lines in sorted(
authors.items(), key=lambda x: x[1], reverse=True
):
Expand Down
46 changes: 23 additions & 23 deletions test/snapshots/test_e2e/test_full_workflow/authorship.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,9 @@ path,author,lines
.,Joseph Hale <[email protected]>,241532
.,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,116
.,Joseph Hale <[email protected]>,74
git_authorship,Joseph Hale <[email protected]>,171
git_authorship/__main__.py,Joseph Hale <[email protected]>,166
git_authorship/__init__.py,Joseph Hale <[email protected]>,5
.gitignore,Joseph Hale <[email protected]>,169
LICENSE,Joseph Hale <[email protected]>,373
README.md,Joseph Hale <[email protected]>,139
README.md,Joseph Hale <[email protected]>,5
.devcontainer,Joseph Hale <[email protected]>,41
.devcontainer/devcontainer.json,Joseph Hale <[email protected]>,32
.devcontainer/Dockerfile,Joseph Hale <[email protected]>,9
pyproject.toml,Joseph Hale <[email protected]>,45
pyproject.toml,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,7
docs,Joseph Hale <[email protected]>,240056
docs/git-authorship-demo-cubingjs.gif,Joseph Hale <[email protected]>,238279
docs/git-authorship-social-preview.svg,Joseph Hale <[email protected]>,1111
docs/git-authorship-social-preview.png,Joseph Hale <[email protected]>,666
config,Joseph Hale <[email protected]>,12
config/.gitignore,Joseph Hale <[email protected]>,8
config/pseudonyms.txt.dist,Joseph Hale <[email protected]>,2
config/author-licenses.txt.dist,Joseph Hale <[email protected]>,2
poetry.lock,Joseph Hale <[email protected]>,433
poetry.lock,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,109
.devcontainer/devcontainer.json,Joseph Hale <[email protected]>,32
.github,Joseph Hale <[email protected]>,69
.github,Joseph Hale <[email protected]>,13
.github/dependabot.yml,Joseph Hale <[email protected]>,22
Expand All @@ -32,9 +13,28 @@ poetry.lock,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,
.github/workflows/auto-merge-dependabot.yml,Joseph Hale <[email protected]>,23
.github/workflows/precommit.yml,Joseph Hale <[email protected]>,24
.github/workflows/precommit.yml,Joseph Hale <[email protected]>,13
test,Joseph Hale <[email protected]>,9
test/test_authorship_analyzer.py,Joseph Hale <[email protected]>,9
.gitignore,Joseph Hale <[email protected]>,169
.pre-commit-config.yaml,Joseph Hale <[email protected]>,42
.vscode,Joseph Hale <[email protected]>,16
.vscode/launch.json,Joseph Hale <[email protected]>,16
LICENSE,Joseph Hale <[email protected]>,373
Makefile,Joseph Hale <[email protected]>,13
.pre-commit-config.yaml,Joseph Hale <[email protected]>,42
README.md,Joseph Hale <[email protected]>,139
README.md,Joseph Hale <[email protected]>,5
config,Joseph Hale <[email protected]>,12
config/.gitignore,Joseph Hale <[email protected]>,8
config/author-licenses.txt.dist,Joseph Hale <[email protected]>,2
config/pseudonyms.txt.dist,Joseph Hale <[email protected]>,2
docs,Joseph Hale <[email protected]>,240056
docs/git-authorship-demo-cubingjs.gif,Joseph Hale <[email protected]>,238279
docs/git-authorship-social-preview.png,Joseph Hale <[email protected]>,666
docs/git-authorship-social-preview.svg,Joseph Hale <[email protected]>,1111
git_authorship,Joseph Hale <[email protected]>,171
git_authorship/__init__.py,Joseph Hale <[email protected]>,5
git_authorship/__main__.py,Joseph Hale <[email protected]>,166
poetry.lock,Joseph Hale <[email protected]>,433
poetry.lock,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,109
pyproject.toml,Joseph Hale <[email protected]>,45
pyproject.toml,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,7
test,Joseph Hale <[email protected]>,9
test/test_authorship_analyzer.py,Joseph Hale <[email protected]>,9

0 comments on commit 325cb9e

Please sign in to comment.