From 746805004c661ebf8147cba54c962919a5b2c324 Mon Sep 17 00:00:00 2001 From: AllyW Date: Fri, 7 Jul 2023 11:55:08 +0800 Subject: [PATCH] add rule link (#402) --- azdev/operations/command_change/custom.py | 3 ++- azdev/operations/command_change/meta_changes.py | 4 +++- azdev/utilities/__init__.py | 4 ++++ azdev/utilities/const.py | 3 +++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/azdev/operations/command_change/custom.py b/azdev/operations/command_change/custom.py index fb835fa3..aa4aed19 100644 --- a/azdev/operations/command_change/custom.py +++ b/azdev/operations/command_change/custom.py @@ -25,7 +25,8 @@ class DiffExportFormat(Enum): class MetaChangeDetects: - EXPORTED_META_PROPERTY = ["rule_id", "is_break", "rule_message", "suggest_message", "cmd_name", "subgroup_name"] + EXPORTED_META_PROPERTY = ["rule_id", "rule_link_url", "is_break", "rule_message", "suggest_message", + "cmd_name", "subgroup_name"] CHECKED_PARA_PROPERTY = ["name", "options", "required", "choices", "id_part", "nargs", "default", "desc", "aaz_type", "type", "aaz_default", "aaz_choices"] diff --git a/azdev/operations/command_change/meta_changes.py b/azdev/operations/command_change/meta_changes.py index 9c012595..d01fc2a0 100644 --- a/azdev/operations/command_change/meta_changes.py +++ b/azdev/operations/command_change/meta_changes.py @@ -4,13 +4,15 @@ # license information. # ----------------------------------------------------------------------------- -from azdev.utilities import get_change_rule_template, get_change_suggest_template +from azdev.utilities import get_change_rule_template, get_change_suggest_template, \ + BREAKING_CHANE_RULE_LINK_URL_PREFIX, BREAKING_CHANE_RULE_LINK_URL_SUFFIX class MetaChange: def __init__(self, rule_id="1000", is_break=False, rule_message="", suggest_message=""): self.rule_id = rule_id + self.rule_link_url = BREAKING_CHANE_RULE_LINK_URL_PREFIX + self.rule_id + BREAKING_CHANE_RULE_LINK_URL_SUFFIX self.is_break = is_break self.rule_message = rule_message self.suggest_message = suggest_message diff --git a/azdev/utilities/__init__.py b/azdev/utilities/__init__.py index 0330e4e0..6ecf913c 100644 --- a/azdev/utilities/__init__.py +++ b/azdev/utilities/__init__.py @@ -20,6 +20,8 @@ CommandError ) from .const import ( + BREAKING_CHANE_RULE_LINK_URL_PREFIX, + BREAKING_CHANE_RULE_LINK_URL_SUFFIX, CMD_PROPERTY_ADD_BREAK_LIST, CMD_PROPERTY_REMOVE_BREAK_LIST, CMD_PROPERTY_UPDATE_BREAK_LIST, @@ -67,6 +69,8 @@ __all__ = [ 'COMMAND_MODULE_PREFIX', 'EXTENSION_PREFIX', + 'BREAKING_CHANE_RULE_LINK_URL_PREFIX', + 'BREAKING_CHANE_RULE_LINK_URL_SUFFIX', 'CMD_PROPERTY_ADD_BREAK_LIST', 'CMD_PROPERTY_REMOVE_BREAK_LIST', 'CMD_PROPERTY_UPDATE_BREAK_LIST', diff --git a/azdev/utilities/const.py b/azdev/utilities/const.py index 02cae108..64394b28 100644 --- a/azdev/utilities/const.py +++ b/azdev/utilities/const.py @@ -15,6 +15,9 @@ ENV_VAR_VIRTUAL_ENV = ['VIRTUAL_ENV', 'CONDA_PREFIX'] # used by system to identify virtual environment ENV_VAR_TEST_LIVE = 'AZURE_TEST_RUN_LIVE' # denotes that tests should be run live instead of played back +BREAKING_CHANE_RULE_LINK_URL_PREFIX = "https://github.com/Azure/azure-cli/blob/dev/doc/breaking_change_rules/" +BREAKING_CHANE_RULE_LINK_URL_SUFFIX = ".md" + CMD_PROPERTY_REMOVE_BREAK_LIST = [] CMD_PROPERTY_ADD_BREAK_LIST = ["confirmation"] CMD_PROPERTY_UPDATE_BREAK_LIST = []