-
Notifications
You must be signed in to change notification settings - Fork 59
Enhance performance of aaz-dev command-model verify
#433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/aaz_dev/command/api/_cmds.py
Outdated
with open(json_path, "r", encoding="utf-8", errors="ignore") as fp: | ||
model = json.load(fp) | ||
group, command = " ".join(node.names[:-1]), node.names[-1] | ||
for g in model["commandGroups"]: | ||
if g["name"] == group: | ||
if not any(cmd["name"] == command for cmd in g["commands"]): | ||
raise Exception(f"There is no {command} command info in {json_path}.") | ||
|
||
break | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why removed this? It seems the json path is the command model path right? We only remove tree.json file not all json files in aaz repo
raise Exception(f"{curr_grp} defined in {json_path} has command that doesn't exist.") | ||
|
||
break | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One potential bug: if the model has sub command group for sub commands and this command group not defined in *.md the will not check those commands
src/aaz_dev/command/api/_cmds.py
Outdated
group.append(model["commandGroups"][0]["name"]) | ||
if " ".join(group) == curr_grp: | ||
break | ||
|
||
model_set.add(json_path) | ||
model = model["commandGroups"][0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why always using [0] I think there many have multiple sub command groups like https://raw.githubusercontent.com/Azure/aaz/refs/heads/main/Resources/mgmt-plane/L3N1YnNjcmlwdGlvbnMve30vcmVzb3VyY2Vncm91cHMve30vcHJvdmlkZXJzL21pY3Jvc29mdC5uZXR3b3JrL2xvYWRiYWxhbmNlcnMve30%3D/2023-04-01.xml
As #409 will drop
tree.json
, we don't need to verify it anymore.Obviously, the performance will be enhanced and Git Hooks will benefits from that.