func()

in rules/terraform_locals_order.go [118:132]


func (r *TerraformLocalsOrderRule) attributesInLineOrder(block *hclsyntax.Block) []*hclsyntax.Attribute {
	var attributes []*hclsyntax.Attribute
	for _, attribute := range block.Body.Attributes {
		attributes = append(attributes, attribute)
	}
	sort.Slice(attributes, func(x, y int) bool {
		posX := attributes[x].SrcRange.Start
		posY := attributes[y].SrcRange.Start
		if posX.Line == posY.Line {
			return posX.Column < posY.Column
		}
		return posX.Line < posY.Line
	})
	return attributes
}