Skip to content

The line length when running smithy format can be over 120 characters #3136

@JamesMilnerAC

Description

@JamesMilnerAC

From my understanding smithy format should have some maximum line length as suggested by the tests:

However if you have object that looks like SomeAuthorizer here:

apply SomeService @authorizers({
    SomeAuthorizer: { 
        scheme: httpBearerAuth, 
        type: "request",
        identitySource: "method.request.header.Authorization", 
        uri: "${someAuthorizerInvokeArn}", 
        resultTtlInSeconds: 1000 
    }
})

The formatter will produce:

apply SomeService @authorizers({
    SomeAuthorizer: { scheme: httpBearerAuth, type: "request", identitySource: "method.request.header.Authorization", uri: "${someAuthorizerInvokeArn}", resultTtlInSeconds: 1000 }
})

Which has a column length of 180. In fact there seems to be no line length limit at all in this scenario:

apply SomeService @authorizers({
    SomeAuthorizer: { 
        scheme: httpBearerAuth, 
        type: "request",
        identitySource: "method.request.header.Authorization", 
        uri: "${someAuthorizerInvokeArn}", 
        resultTtlInSeconds: 1000,
        someOtherProperty: "someValue"
        someOtherProperty2: "someValue2"
        someOtherProperty3: "someValue3"
        someOtherProperty4: "someValue4"
        someOtherProperty5: "someValue5"
        someOtherProperty6: "someValue6"
        someOtherProperty7: "someValue7"
        someOtherProperty8: "someValue8"
        someOtherProperty9: "someValue9"
        someOtherProperty10: "someValue10"
    }
})

Will produce:

apply SomeService @authorizers({
    SomeAuthorizer: { scheme: httpBearerAuth, type: "request", identitySource: "method.request.header.Authorization", uri: "${someAuthorizerInvokeArn}", resultTtlInSeconds: 1000, someOtherProperty: "someValue", someOtherProperty2: "someValue2", someOtherProperty3: "someValue3", someOtherProperty4: "someValue4", someOtherProperty5: "someValue5", someOtherProperty6: "someValue6", someOtherProperty7: "someValue7", someOtherProperty8: "someValue8", someOtherProperty9: "someValue9", someOtherProperty10: "someValue10" }
})

Which is 520 characters long. This is quite awkward and very hard to read. In this scenario my expectation is each key value pair would appear on a new line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions