Skip to content

Commit e0bc52f

Browse files
Copilotzkoppert
andcommitted
refactor(markdown): use boolean flag for profile linking and sponsor info
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
1 parent f6f5e3e commit e0bc52f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

markdown.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ def get_contributor_table(
159159
columns = ["Username", "All Time Contribution Count"]
160160
if start_date and end_date:
161161
columns += ["New Contributor"]
162-
if sponsor_info == "true":
162+
# Add Sponsor URL column if sponsor_info is True
163+
if sponsor_info:
163164
columns += ["Sponsor URL"]
164165
if start_date and end_date:
165166
columns += [f"Commits between {start_date} and {end_date}"]
@@ -191,8 +192,8 @@ def get_contributor_table(
191192
commit_urls += f"{url}, "
192193
new_contributor = collaborator.new_contributor
193194

194-
# Determine prefix for username: hyperlink if link_to_profile equals 'true' (string or bool)
195-
prefix = "@" if str(link_to_profile).strip().lower() == "true" else ""
195+
# Determine prefix for username based on boolean link_to_profile
196+
prefix = "@" if link_to_profile else ""
196197
row = f"| {prefix}{username} | {contribution_count} |"
197198
if "New Contributor" in columns:
198199
row += f" {new_contributor} |"

test_markdown.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_write_to_markdown(self, mock_file):
4848
"2023-01-02",
4949
None,
5050
"org/repo",
51-
"false",
51+
False,
5252
True,
5353
ghe,
5454
)
@@ -104,7 +104,7 @@ def test_write_to_markdown_with_sponsors(self, mock_file):
104104
"2023-01-02",
105105
None,
106106
"org/repo",
107-
"true",
107+
True,
108108
True,
109109
ghe,
110110
)
@@ -160,7 +160,7 @@ def test_write_to_markdown_without_link_to_profile(self, mock_file):
160160
"2023-01-02",
161161
None,
162162
"org/repo",
163-
"false",
163+
False,
164164
False,
165165
ghe,
166166
)
@@ -216,8 +216,8 @@ def test_write_to_markdown_with_string_false_link_to_profile(self, mock_file):
216216
"2023-01-02",
217217
None,
218218
"org/repo",
219-
"false",
220-
"false",
219+
False,
220+
False,
221221
ghe,
222222
)
223223

0 commit comments

Comments
 (0)