Skip to content
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

[Core] Linter rule for service_name.json #3186

Merged
merged 14 commits into from
Apr 19, 2021
Merged

[Core] Linter rule for service_name.json #3186

merged 14 commits into from
Apr 19, 2021

Conversation

qwordy
Copy link
Member

@qwordy qwordy commented Mar 25, 2021

Check format of service_name.json. Command and AzureServiceName are required. Others are optional.
Each highest level command group should have reference in service_name.json.
It only runs on modified extensions. I have tested it with modification on extension. This PR itself will not modify any extension.


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your PR is merged into master branch, a new PR will be created to update src/index.json automatically.
The precondition is to put your code inside this repo and upgrade the version in the PR but do not modify src/index.json.

@qwordy qwordy changed the title service_name.py [Core] Linter rule for service_name.json Mar 26, 2021
@qwordy qwordy marked this pull request as ready for review March 26, 2021 08:51
@qwordy qwordy requested a review from fengzhou-msft as a code owner March 26, 2021 08:57
Comment on lines +69 to +77
def _store_parsers(parser, parser_keys, parser_values, sub_parser_keys, sub_parser_values):
for s in parser.subparsers.values():
parser_keys.append(_get_parser_name(s))
parser_values.append(s)
if _is_group(s):
for c in s.choices.values():
sub_parser_keys.append(_get_parser_name(c))
sub_parser_values.append(c)
_store_parsers(c, parser_keys, parser_values, sub_parser_keys, sub_parser_values)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reuse the same function in azure-cli-core?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reuse code from azure-cli-extensions

scripts/ci/service_name.py Outdated Show resolved Hide resolved
src/service_name.json Outdated Show resolved Hide resolved
src/service_name.json Outdated Show resolved Hide resolved
src/service_name.json Outdated Show resolved Hide resolved
@qwordy qwordy requested a review from kairu-ms April 15, 2021 09:03
for help_file in help_files:
if help_file.command:
high_command_set.add(help_file.command.split()[0])
print('high_command_set:')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is high command an existing term or coined by you? Is it OK to use command group to refer to the same thing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The left most word in a command, e.g., vm, disk. Let me add a comment.

scripts/ci/service_name.py Outdated Show resolved Hide resolved
@qwordy qwordy merged commit 57af753 into Azure:master Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants