Skip to content

Commit

Permalink
run black and lint things
Browse files Browse the repository at this point in the history
Signed-off-by: Zack Koppert <[email protected]>
  • Loading branch information
zkoppert committed Jan 10, 2024
1 parent 2779dfb commit d283a9a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"threshold": 25,
"threshold": 50,
"ignore": [
"test*"
],
"absolute": true
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Below are the allowed configuration options:
| `START_DATE` | False | Beginning of time | The date from which you want to start gathering contributor information. ie. Aug 1st, 2023 would be `2023-08-01` If `start_date` and `end_date` are specified then the action will determine if the contributor is new. A new contributor is one that has contributed in the date range specified but not before the start date. **Performance Note:** Using start and end dates will reduce speed of the action by approximately 63X. ie without dates if the action takes 1.7 seconds, it will take 1 minute and 47 seconds.|
| `END_DATE` | False | Current Date | The date at which you want to stop gathering contributor information. Must be later than the `START_DATE`. ie. Aug 2nd, 2023 would be `2023-08-02` If `start_date` and `end_date` are specified then the action will determine if the contributor is new. A new contributor is one that has contributed in the date range specified but not before the start date. |
| `SPONSOR_INFO` | False | False | If you want to include sponsor information in the output. This will include the sponsor count and the sponsor URL. This will impact action performance. ie. SPONSOR_INFO = "False" or SPONSOR_INFO = "True" |
| `LINK_TO_PROFILE` | False | True | If you want to link usernames to their Github profiles in the output. ie. LINK_TO_PROFILE = "True" or LINK_TO_PROFILE = "False" |
| `LINK_TO_PROFILE` | False | True | If you want to link usernames to their GitHub profiles in the output. ie. LINK_TO_PROFILE = "True" or LINK_TO_PROFILE = "False" |

### Example workflows

Expand Down
16 changes: 14 additions & 2 deletions markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ def write_to_markdown(
"""
# Put together the contributor table
table, total_contributions = get_contributor_table(
collaborators, start_date, end_date, organization, repository, sponsor_info, link_to_profile
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
Expand Down Expand Up @@ -129,7 +135,13 @@ def get_summary_table(collaborators, start_date, end_date, total_contributions):


def get_contributor_table(
collaborators, start_date, end_date, organization, repository, sponsor_info, link_to_profile
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.
Expand Down
4 changes: 2 additions & 2 deletions test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_get_env_vars(self, mock_getenv):
"2022-01-01",
"2022-12-31",
"False",
"True"
"True",
]

(
Expand All @@ -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(link_to_profile, 'true')
self.assertEqual(link_to_profile, "true")

@patch("os.getenv")
def test_get_env_vars_missing_values(self, mock_getenv):
Expand Down
6 changes: 3 additions & 3 deletions test_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_write_to_markdown(self, mock_file):
None,
"org/repo",
"false",
"true"
"true",
)

mock_file.assert_called_once_with("filename", "w", encoding="utf-8")
Expand Down Expand Up @@ -101,7 +101,7 @@ def test_write_to_markdown_with_sponsors(self, mock_file):
None,
"org/repo",
"true",
"true"
"true",
)

mock_file.assert_called_once_with("filename", "w", encoding="utf-8")
Expand Down Expand Up @@ -155,7 +155,7 @@ def test_write_to_markdown_without_link_to_profile(self, mock_file):
None,
"org/repo",
"false",
"false"
"false",
)

mock_file.assert_called_once_with("filename", "w", encoding="utf-8")
Expand Down

0 comments on commit d283a9a

Please sign in to comment.