Skip to content

Commit 90ef682

Browse files
Fix structure of logic to determine whether to add new bitbucket steps (versus rely on pre-commit)
1 parent 937a94b commit 90ef682

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/usethis/_tool/base.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -678,25 +678,25 @@ def update_bitbucket_steps(self, *, matrix_python: bool = True) -> None:
678678
matrix_python: Whether to use a Python version matrix. When False,
679679
only the current development version is used.
680680
"""
681-
# If pre-commit is being used and this is not the PreCommitTool itself,
682-
# don't add Bitbucket steps (the tool will run via pre-commit instead)
683-
if is_pre_commit_used():
684-
return
685-
686-
self._unconditional_update_bitbucket_steps(matrix_python=matrix_python)
681+
# If pre-commit is being used, we assume the tool is running via pre-commit,
682+
# and we don't need to add a separate Bitbucket step for it.
683+
self._unconditional_update_bitbucket_steps(
684+
matrix_python=matrix_python, skip_add=is_pre_commit_used()
685+
)
687686

688687
def _unconditional_update_bitbucket_steps(
689-
self, *, matrix_python: bool = True
688+
self, *, matrix_python: bool = True, skip_add: bool = False
690689
) -> None:
691690
if not is_bitbucket_used() or not self.is_used():
692691
return
693692

694693
# Add the new steps
695694
steps = self.get_bitbucket_steps(matrix_python=matrix_python)
696-
for step in steps:
697-
add_bitbucket_step_in_default(step)
695+
if not skip_add:
696+
for step in steps:
697+
add_bitbucket_step_in_default(step)
698698

699-
# Remove any old steps that are not active managed by this tool
699+
# Remove any old steps that are not actively managed by this tool
700700
managed_names = self.get_managed_bitbucket_step_names()
701701

702702
# Early return if there are no steps to add and no managed steps to clean up

0 commit comments

Comments
 (0)