Enhance performance of aaz-dev command-model verify#433
Merged
Conversation
kairu-ms
reviewed
Dec 16, 2024
Comment on lines
181
to
190
| 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 | ||
|
|
Collaborator
There was a problem hiding this comment.
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
kairu-ms
reviewed
Dec 16, 2024
| raise Exception(f"{curr_grp} defined in {json_path} has command that doesn't exist.") | ||
|
|
||
| break | ||
|
|
Collaborator
There was a problem hiding this comment.
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
kairu-ms
reviewed
Dec 18, 2024
src/aaz_dev/command/api/_cmds.py
Outdated
Comment on lines
198
to
202
| group.append(model["commandGroups"][0]["name"]) | ||
| if " ".join(group) == curr_grp: | ||
| break | ||
|
|
||
| model_set.add(json_path) | ||
| model = model["commandGroups"][0] |
Collaborator
There was a problem hiding this comment.
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
kairu-ms
approved these changes
Dec 20, 2024
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.