diff --git a/contributors.py b/contributors.py index b4b32e6..3e34956 100644 --- a/contributors.py +++ b/contributors.py @@ -21,7 +21,7 @@ def main(): start_date, end_date, sponsor_info, - ltp + link_to_profile ) = env.get_env_vars() # Auth to GitHub.com @@ -65,7 +65,7 @@ def main(): organization, repository_list, sponsor_info, - ltp + link_to_profile ) # write_to_json(contributors) diff --git a/env.py b/env.py index 7279ecc..f7b45ab 100644 --- a/env.py +++ b/env.py @@ -68,11 +68,11 @@ def get_env_vars() -> ( "SPONSOR_INFO environment variable not a boolean. ie. True or False or blank" ) - ltp = os.getenv("LINK_TO_PROFILE") - # make sure that ltp is a boolean - if ltp: - ltp = ltp.lower().strip() - if ltp not in ["true", "false", ""]: + link_to_profile = os.getenv("LINK_TO_PROFILE") + # make sure that link_to_profile is a boolean + if link_to_profile: + link_to_profile = link_to_profile.lower().strip() + if link_to_profile not in ["true", "false", ""]: raise ValueError( "LINK_TO_PROFILE environment variable not a boolean. ie. True or False or blank" ) @@ -92,5 +92,5 @@ def get_env_vars() -> ( start_date, end_date, sponsor_info, - ltp, + link_to_profile, ) diff --git a/markdown.py b/markdown.py index 0b2f912..fb6e401 100644 --- a/markdown.py +++ b/markdown.py @@ -10,7 +10,7 @@ def write_to_markdown( organization, repository, sponsor_info, - ltp + link_to_profile ): """ This function writes a list of collaborators to a markdown file in table format. @@ -25,7 +25,7 @@ def write_to_markdown( organization (str): The organization for which the contributors are being listed. repository (str): The repository for which the contributors are being listed. sponsor_info (str): True if the user wants the sponsor_url shown in the report - ltp (str): True if the user wants the username linked to Github profile in the report + link_to_profile (str): True if the user wants the username linked to Github profile in the report Returns: None @@ -33,7 +33,7 @@ def write_to_markdown( """ # Put together the contributor table table, total_contributions = get_contributor_table( - collaborators, start_date, end_date, organization, repository, sponsor_info, ltp + collaborators, start_date, end_date, organization, repository, sponsor_info, link_to_profile ) # Put together the summary table including # of new contributions, # of new contributors, % new contributors, % returning contributors @@ -129,7 +129,7 @@ def get_summary_table(collaborators, start_date, end_date, total_contributions): def get_contributor_table( - collaborators, start_date, end_date, organization, repository, sponsor_info, ltp + collaborators, start_date, end_date, organization, repository, sponsor_info, link_to_profile ): """ This function returns a string containing a markdown table of the contributors and the total contribution count. @@ -142,7 +142,7 @@ def get_contributor_table( organization (str): The organization for which the contributors are being listed. repository (str): The repository for which the contributors are being listed. sponsor_info (str): True if the user wants the sponsor_url shown in the report - ltp (str): True if the user wants the username linked to Github profile in the report + link_to_profile (str): True if the user wants the username linked to Github profile in the report Returns: table (str): A string containing a markdown table of the contributors and the total contribution count. @@ -180,7 +180,7 @@ def get_contributor_table( commit_urls += url + ", " new_contributor = collaborator.new_contributor - row = f"| {'' if ltp == 'false' else '@'}{username} | {contribution_count} |" + row = f"| {'' if link_to_profile == 'false' else '@'}{username} | {contribution_count} |" if "New Contributor" in columns: row += f" {new_contributor} |" if "Sponsor URL" in columns: diff --git a/test_env.py b/test_env.py index 39597c2..c56c35b 100644 --- a/test_env.py +++ b/test_env.py @@ -35,7 +35,7 @@ def test_get_env_vars(self, mock_getenv): start_date, end_date, sponsor_info, - ltp + link_to_profile ) = env.get_env_vars() self.assertEqual(organization, "org") @@ -45,7 +45,7 @@ def test_get_env_vars(self, mock_getenv): self.assertEqual(start_date, "2022-01-01") self.assertEqual(end_date, "2022-12-31") self.assertEqual(sponsor_info, "false") - self.assertEqual(ltp, 'true') + self.assertEqual(link_to_profile , 'true') @patch("os.getenv") def test_get_env_vars_missing_values(self, mock_getenv):