{Core} Fix incorrect _get_message and _get_tag in MergedStatusTag#31574
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes incorrect parameter usage in the merged tag and message helpers of MergedStatusTag so that each tag’s own methods receive the correct context.
_get_merged_tagnow passes each individual tag to its_get_tagmethod instead of the merged object._get_merged_msgnow passes each individual tag to its_get_messagemethod instead of the merged object.
| return ''.join({tag._get_tag(tag) for tag in self.tags}) # pylint: disable=protected-access | ||
|
|
||
| def _get_merged_msg(self): | ||
| return '\n'.join({tag._get_message(self) for tag in self.tags}) # pylint: disable=protected-access | ||
| return '\n'.join({tag._get_message(tag) for tag in self.tags}) # pylint: disable=protected-access |
There was a problem hiding this comment.
Using a set comprehension here can lead to unpredictable ordering and will drop duplicate tags. If you need to preserve the original order (and possible duplicates), use a list or generator expression, for example: ''.join(tag._get_tag(tag) for tag in self.tags).
|
|
||
| def _get_merged_msg(self): | ||
| return '\n'.join({tag._get_message(self) for tag in self.tags}) # pylint: disable=protected-access | ||
| return '\n'.join({tag._get_message(tag) for tag in self.tags}) # pylint: disable=protected-access |
There was a problem hiding this comment.
Similar to the tag merge, this set comprehension will reorder messages and remove duplicates. Consider using \n.join(tag._get_message(tag) for tag in self.tags) to keep the original sequence intact.
| return '\n'.join({tag._get_message(tag) for tag in self.tags}) # pylint: disable=protected-access | |
| return '\n'.join(tag._get_message(tag) for tag in self.tags) # pylint: disable=protected-access |
Related command
Description
This is a fix for incorrect _get_message and _get_tag in MergedStatusTag. Document generation directly call _get_message from a tag but there is a bug in its implementation.
This didn't be discovered because cli call property method message(self) and tag(self) instead of _get_message and _get_tag.
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.