Azure / autorest.az

Azure CLI Code Generator
MIT License
22 stars 20 forks source link

Style and Linter Error in Generated Code #800

Closed qwordy closed 3 years ago

qwordy commented 3 years ago

Why do you need this feature?

I must fix style error in generated code, otherwise I can't merge. But generated code should not be changed.

Is your feature request related to a problem? Please describe.

https://github.com/Azure/azure-rest-api-specs/blob/master/specification/compute/resource-manager/Microsoft.Compute/preview/2020-10-01-preview/cloudService.json

  1. example_steps.py: W391 blank line at end of file.
  2. commands.py:26:0: C0330: Wrong hanging indentation before block (add 4 spaces).
    with self.command_group(
        'cloud-service role-instance',

    It should be

    with self.command_group(
            'cloud-service role-instance',
  3. No command. Only name.
    helps['cloud-service role-instance wait'] = """
    type: command
    short-summary: Place the CLI in a waiting state until a condition of the cloud-service role-instance \
    is met.
    examples:
      - name: Pause executing next line of CLI script until the cloud-service role-instance is \
    successfully deleted.
      - name: Pause executing next line of CLI script until the cloud-service role-instance is \
    successfully created.
    """
    helps['cloud-service wait'] = """
    type: command
    short-summary: Place the CLI in a waiting state until a condition of the cloud-service is met.
    examples:
      - name: Pause executing next line of CLI script until the cloud-service is successfully created.
    """
  4. All "cloud_service_name" miss help.
    with self.argument_context('cloud-service role-instance list') as c:
        c.argument('resource_group_name', resource_group_name_type)
        c.argument('cloud_service_name', type=str, help='')

Describe the solution you'd like

Fix style and linter error

Describe alternatives you've considered

Additional context

changlong-liu commented 3 years ago

Hi @qwordy, would you try latest private release, thanks!

changlong-liu commented 3 years ago

Hi @qwordy , the latest private release should have fix item 1. I will check the item 2~4

changlong-liu commented 3 years ago

Hi @qwordy,

I checked as below: item 1: fixed in latest private release item2: we are using Python "black" to format the code, seems the current result is correct. And "azdev style cloudservice" don't complain about it in my side. item3: should be related to swagger example, I can't reproduce this in latest swagger. item4: there is no "description" for this field in swagger.

qwordy commented 3 years ago

Thanks, changlong. I wonder how the swagger file gets merged. It misses description.

changlong-liu commented 3 years ago

close this first. for swagger concern, we can propose lint rule