From b3c70b5771037fcb5dbc427b79420eaca94a47ec Mon Sep 17 00:00:00 2001 From: Webb Scales Date: Fri, 24 Oct 2025 17:16:36 -0400 Subject: [PATCH 1/3] Remove unused parameter from _update_on_close() --- sync2jira/downstream_issue.py | 5 ++--- tests/test_downstream_issue.py | 12 ++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/sync2jira/downstream_issue.py b/sync2jira/downstream_issue.py index e41a5028..e126cbb0 100644 --- a/sync2jira/downstream_issue.py +++ b/sync2jira/downstream_issue.py @@ -763,7 +763,7 @@ def _update_jira_issue(existing, issue, client, config): # and when the issue is closed. if issue.status == "Closed": log.info("Attempting to update downstream issue on upstream closed event") - _update_on_close(existing, issue, updates) + _update_on_close(existing, updates) log.info("Done updating %s!", issue.url) @@ -1108,7 +1108,7 @@ def _update_description(existing, issue): UPDATE_ENTRY = Union[str, dict[str, Union[str, dict[str, Any]]]] -def _update_on_close(existing, issue, updates: list[UPDATE_ENTRY]): +def _update_on_close(existing, updates: list[UPDATE_ENTRY]): """Update downstream Jira issue when upstream issue was closed Example update configuration: @@ -1127,7 +1127,6 @@ def _update_on_close(existing, issue, updates: list[UPDATE_ENTRY]): ] :param jira.resource.Issue existing: existing Jira issue - :param sync2jira.intermediary.Issue issue: Upstream issue :param dict updates: update configuration :return: None """ diff --git a/tests/test_downstream_issue.py b/tests/test_downstream_issue.py index 90c95ca6..eccac67e 100644 --- a/tests/test_downstream_issue.py +++ b/tests/test_downstream_issue.py @@ -1548,11 +1548,10 @@ def test_update_on_close_update(self): """ # Set up return values self.mock_downstream.fields.description = "" - self.mock_issue.status = "Closed" updates = [{"on_close": {"apply_labels": ["closed-upstream"]}}] # Call the function - d._update_on_close(self.mock_downstream, self.mock_issue, updates) + d._update_on_close(self.mock_downstream, updates) # Assert everything was called correctly self.mock_downstream.update.assert_called_with( @@ -1565,11 +1564,10 @@ def test_update_on_close_no_change(self): "apply_labels" configuration but there is no update required. """ # Set up return values - self.mock_issue.status = "Closed" updates = [{"on_close": {"apply_labels": ["tag4"]}}] # Call the function - d._update_on_close(self.mock_downstream, self.mock_issue, updates) + d._update_on_close(self.mock_downstream, updates) # Assert everything was called correctly self.mock_downstream.update.assert_not_called() @@ -1580,11 +1578,10 @@ def test_update_on_close_no_action(self): "apply_labels" configuration. """ # Set up return values - self.mock_issue.status = "Closed" updates = [{"on_close": {"some_other_action": None}}] # Call the function - d._update_on_close(self.mock_downstream, self.mock_issue, updates) + d._update_on_close(self.mock_downstream, updates) # Assert everything was called correctly self.mock_downstream.update.assert_not_called() @@ -1595,11 +1592,10 @@ def test_update_on_close_no_config(self): configuration for close events. """ # Set up return values - self.mock_issue.status = "Closed" updates = ["description"] # Call the function - d._update_on_close(self.mock_downstream, self.mock_issue, updates) + d._update_on_close(self.mock_downstream, updates) # Assert everything was called correctly self.mock_downstream.update.assert_not_called() From 1e78abf6583db0bec4b8efe9cfd9b37d2bdb0e72 Mon Sep 17 00:00:00 2001 From: Webb Scales Date: Fri, 24 Oct 2025 17:18:04 -0400 Subject: [PATCH 2/3] Correct line wrapping --- docs/source/config-file.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/source/config-file.rst b/docs/source/config-file.rst index 690b6042..7e726efb 100644 --- a/docs/source/config-file.rst +++ b/docs/source/config-file.rst @@ -126,9 +126,7 @@ The config file is made up of multiple parts * Sync fixVersion (downstream milestone), do/don't overwrite downstream fixVersion * :code:`{'assignee': {'overwrite': True/False}}` * Sync assignee (for Github only the first assignee will sync) do/don't overwrite downstream assignee - * Note that the downstream assignee is selected by performing an LDAP query for the upstream user in the -"Professional Social Media" link in the RoverPeople profiles, so, in order for this feature to work properly, each -potential assignee needs to ensure that they have added their upstream identity(es) to their Rover profile. + * Note that the downstream assignee is selected by performing an LDAP query for the upstream user in the "Professional Social Media" link in the RoverPeople profiles, so, in order for this feature to work properly, each potential assignee needs to ensure that they have added their upstream identity(es) to their Rover profile. * :code:`'description'` * Sync description * :code:`'title'` From adb36125eba13f829a87b5b3eb415aaeed5d2f78 Mon Sep 17 00:00:00 2001 From: Webb Scales Date: Fri, 24 Oct 2025 17:26:33 -0400 Subject: [PATCH 3/3] Wrap long source lines (properly) --- docs/source/config-file.rst | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/source/config-file.rst b/docs/source/config-file.rst index 7e726efb..8946ab2b 100644 --- a/docs/source/config-file.rst +++ b/docs/source/config-file.rst @@ -116,7 +116,7 @@ The config file is made up of multiple parts * You can add your projects here. The :code:`'project'` field is associated with downstream JIRA projects, and :code:`'component'` with downstream - components. You can add the following to the :code:`issue_updates` array: + components. You can add the following to the :code:`issue_updates` array: * :code:`'comments'` * Sync comments and comment edits @@ -126,7 +126,9 @@ The config file is made up of multiple parts * Sync fixVersion (downstream milestone), do/don't overwrite downstream fixVersion * :code:`{'assignee': {'overwrite': True/False}}` * Sync assignee (for Github only the first assignee will sync) do/don't overwrite downstream assignee - * Note that the downstream assignee is selected by performing an LDAP query for the upstream user in the "Professional Social Media" link in the RoverPeople profiles, so, in order for this feature to work properly, each potential assignee needs to ensure that they have added their upstream identity(es) to their Rover profile. + * Note that the downstream assignee is selected by performing an LDAP query for the upstream user in the + "Professional Social Media" link in the RoverPeople profiles, so, in order for this feature to work properly, + each potential assignee needs to ensure that they have added their upstream identity(es) to their Rover profile. * :code:`'description'` * Sync description * :code:`'title'` @@ -138,11 +140,13 @@ The config file is made up of multiple parts * :code:`github_markdown` * If description syncing is turned on, this flag will convert Github markdown to Jira syntax. This uses the pypandoc module. * :code:`upstream_id` - * If selected this will add a comment to all newly created JIRA issue in the format 'UPSTREAM_PROJECT-#1' where the number indicates the issue ID. This allows users to search for the issue on JIRA via the issue number. + * If selected this will add a comment to all newly created JIRA issue in the format 'UPSTREAM_PROJECT-#1' where + the number indicates the issue ID. This allows users to search for the issue on JIRA via the issue number. * :code:`url` * This flag will add the upstream url to the bottom of the JIRA ticket * :code:`github_project_number` - * Specify the GitHub project number. If specified, story points and priority will be selected from this project, and other projects linked to the issues will be ignored. + * Specify the GitHub project number. If specified, story points and priority will be selected from this project, + and other projects linked to the issues will be ignored. * :code:`github_project_fields` * Sync GitHub projects fields. e.g, storypoints, priority @@ -151,21 +155,24 @@ The config file is made up of multiple parts :Overwrite: Setting this to :code:`True` will ensure that Upstream (GitHub) values will overwrite downstream ones (i.e. if its empty upstream it'll be empty downstream) :CUSTOM_TRANSITION: Setting this value will get Sync2Jira to automatically transition downstream tickets once their upstream counterparts get closed. Set this to whatever 'closed' means downstream. -* You can add your projects here. The 'project' field is associated with downstream JIRA projects, and 'component' with downstream components - You can add the following to the :code:`pr_updates` array: +* You can add your projects here. The 'project' field is associated with downstream JIRA projects, and 'component' with + downstream components. You can add the following to the :code:`pr_updates` array: * :code:`{'merge_transition': 'CUSTOM_TRANSITION'}` * Sync when upstream PR gets merged. Attempts to transition JIRA ticket to CUSTOM_TRANSITION on upstream merge * :code:`{'link_transition': 'CUSTOM_TRANSITION'}` * Sync when upstream PR gets linked. Attempts to transition JIRA ticket to CUSTOM_TRANSITION on upstream link -* You can add the following to the mapping array. This array will map an upstream field to the downstream counterpart with XXX replaced. +* You can add the following to the mapping array. This array will map an upstream field to the downstream counterpart + with XXX replaced. * :code:`{'fixVersion': 'Test XXX'}` - * Maps upstream milestone (suppose it's called 'milestone') to downstream fixVersion with a mapping (for our example it would be 'Test milestone') + * Maps upstream milestone (suppose it's called 'milestone') to downstream fixVersion with a mapping (for our + example it would be 'Test milestone') -* It is strongly encouraged for teams to use the :code:`owner` field. If configured, owners will be alerted if Sync2Jira finds duplicate downstream issues. - Further the owner will be used as a default in case the program is unable to find a valid assignee. +* It is strongly encouraged for teams to use the :code:`owner` field. If configured, owners will be alerted if Sync2Jira + finds duplicate downstream issues. Further the owner will be used as a default in case the program is unable to find a + valid assignee. .. code-block:: python