Documentation
¶
Index ¶
- Variables
- func AssertIssues(t *testing.T, expected helper.Issues, actual helper.Issues)
- func Check(runner tflint.Runner, check func(tflint.Runner, *hcl.File) error) error
- func IsHeadMeta(argName string) bool
- func IsTailMeta(argName string) bool
- type Arg
- type Args
- type AzurermArgOrderRule
- func (r *AzurermArgOrderRule) Check(runner tflint.Runner) error
- func (r *AzurermArgOrderRule) CheckFile(runner tflint.Runner, file *hcl.File) error
- func (r *AzurermArgOrderRule) Enabled() bool
- func (r *AzurermArgOrderRule) Link() string
- func (r *AzurermArgOrderRule) Name() string
- func (r *AzurermArgOrderRule) Severity() tflint.Severity
- type AzurermResourceTagRule
- func (r *AzurermResourceTagRule) Check(runner tflint.Runner) error
- func (r *AzurermResourceTagRule) CheckFile(runner tflint.Runner, file *hcl.File) error
- func (r *AzurermResourceTagRule) Enabled() bool
- func (r *AzurermResourceTagRule) Link() string
- func (r *AzurermResourceTagRule) Name() string
- func (r *AzurermResourceTagRule) Severity() tflint.Severity
- type Block
- type HeadMetaArgs
- type NestedBlock
- type NestedBlocks
- type ResourceBlock
- type Section
Constants ¶
This section is empty.
Variables ¶
var Rules = []tflint.Rule{ NewAzurermArgOrderRule(), NewAzurermResourceTagRule(), }
Functions ¶
func AssertIssues ¶
AssertIssues is an assertion helper for comparing issues.
func IsHeadMeta ¶
IsHeadMeta checks whether a name represents a type of head Meta arg
func IsTailMeta ¶
IsTailMeta checks whether a name represents a type of tail Meta arg
Types ¶
type Arg ¶
type Arg struct { Name string Range hcl.Range File *hcl.File }
Arg is a wrapper of the attribute
type Args ¶
type Args struct { Args []*Arg Range *hcl.Range }
Args is the collection of args with the same type
func (*Args) CheckOrder ¶
CheckOrder checks whether this type of args are sorted
type AzurermArgOrderRule ¶
type AzurermArgOrderRule struct {
tflint.DefaultRule
}
AzurermArgOrderRule checks whether the arguments in a block are sorted in azure doc order
func NewAzurermArgOrderRule ¶
func NewAzurermArgOrderRule() *AzurermArgOrderRule
NewAzurermArgOrderRule returns a new rule
func (*AzurermArgOrderRule) CheckFile ¶
func (r *AzurermArgOrderRule) CheckFile(runner tflint.Runner, file *hcl.File) error
CheckFile checks whether the arguments in a block are sorted in codex order
func (*AzurermArgOrderRule) Enabled ¶
func (r *AzurermArgOrderRule) Enabled() bool
func (*AzurermArgOrderRule) Link ¶
func (r *AzurermArgOrderRule) Link() string
func (*AzurermArgOrderRule) Name ¶
func (r *AzurermArgOrderRule) Name() string
Name returns the rule name
func (*AzurermArgOrderRule) Severity ¶
func (r *AzurermArgOrderRule) Severity() tflint.Severity
type AzurermResourceTagRule ¶
type AzurermResourceTagRule struct {
tflint.DefaultRule
}
AzurermResourceTagRule checks whether the tags arg is specified if supported
func NewAzurermResourceTagRule ¶
func NewAzurermResourceTagRule() *AzurermResourceTagRule
NewAzurermResourceTagRule returns a new rule
func (*AzurermResourceTagRule) Check ¶
func (r *AzurermResourceTagRule) Check(runner tflint.Runner) error
func (*AzurermResourceTagRule) CheckFile ¶
func (r *AzurermResourceTagRule) CheckFile(runner tflint.Runner, file *hcl.File) error
CheckFile checks whether the tags arg is specified if supported
func (*AzurermResourceTagRule) Enabled ¶
func (r *AzurermResourceTagRule) Enabled() bool
func (*AzurermResourceTagRule) Link ¶
func (r *AzurermResourceTagRule) Link() string
func (*AzurermResourceTagRule) Name ¶
func (r *AzurermResourceTagRule) Name() string
func (*AzurermResourceTagRule) Severity ¶
func (r *AzurermResourceTagRule) Severity() tflint.Severity
type Block ¶
type Block interface { // CheckBlock checks the resourceBlock/nestedBlock recursively to find the block not in order, // and invoke the emit function on that block CheckBlock() error // ToString prints the sorted block ToString() string // DefRange gets the definition range of the block DefRange() hcl.Range }
Block is an interface offering general APIs on resource/nested block
type HeadMetaArgs ¶
type HeadMetaArgs struct { Args []*Arg Range *hcl.Range }
HeadMetaArgs is the collection of head meta args
func (*HeadMetaArgs) CheckOrder ¶
func (a *HeadMetaArgs) CheckOrder() bool
CheckOrder checks whether the head meta args are sorted
func (*HeadMetaArgs) GetRange ¶
func (a *HeadMetaArgs) GetRange() *hcl.Range
GetRange returns the entire range of head meta args
func (*HeadMetaArgs) ToString ¶
func (a *HeadMetaArgs) ToString() string
ToString prints the head meta args in order
type NestedBlock ¶
type NestedBlock struct { File *hcl.File Block *hclsyntax.Block Name string SortField string Range hcl.Range HeadMetaArgs *HeadMetaArgs RequiredArgs *Args OptionalArgs *Args RequiredNestedBlocks *NestedBlocks OptionalNestedBlocks *NestedBlocks ParentBlockNames []string // contains filtered or unexported fields }
NestedBlock is a wrapper of the nested block
func (*NestedBlock) CheckBlock ¶
func (b *NestedBlock) CheckBlock() error
CheckBlock checks the nestedBlock recursively to find the block not in order, and invoke the emit function on that block
func (*NestedBlock) CheckOrder ¶
func (b *NestedBlock) CheckOrder() bool
CheckOrder checks whether the nestedBlock is sorted
func (*NestedBlock) DefRange ¶
func (b *NestedBlock) DefRange() hcl.Range
DefRange gets the definition range of the nested block
func (*NestedBlock) ToString ¶
func (b *NestedBlock) ToString() string
ToString prints the sorted block
type NestedBlocks ¶
type NestedBlocks struct { Blocks []*NestedBlock Range *hcl.Range }
NestedBlocks is the collection of nestedBlocks with the same type
func (*NestedBlocks) CheckOrder ¶
func (b *NestedBlocks) CheckOrder() bool
CheckOrder checks whether this type of nestedBlocks are sorted
func (*NestedBlocks) GetRange ¶
func (b *NestedBlocks) GetRange() *hcl.Range
GetRange returns the entire range of this type of nestedBlocks
func (*NestedBlocks) ToString ¶
func (b *NestedBlocks) ToString() string
ToString prints this type of nestedBlocks in order
type ResourceBlock ¶
type ResourceBlock struct { File *hcl.File Block *hclsyntax.Block HeadMetaArgs *HeadMetaArgs RequiredArgs *Args OptionalArgs *Args RequiredNestedBlocks *NestedBlocks OptionalNestedBlocks *NestedBlocks TailMetaArgs *Args TailMetaNestedBlocks *NestedBlocks ParentBlockNames []string // contains filtered or unexported fields }
ResourceBlock is the wrapper of a resource block
func BuildResourceBlock ¶
func BuildResourceBlock(block *hclsyntax.Block, file *hcl.File, emitter func(block Block) error) *ResourceBlock
BuildResourceBlock Build the root block wrapper using hclsyntax.Block
func (*ResourceBlock) CheckBlock ¶
func (b *ResourceBlock) CheckBlock() error
CheckBlock checks the resource block and nested block recursively to find the block not in order, and invoke the emit function on that block
func (*ResourceBlock) CheckOrder ¶
func (b *ResourceBlock) CheckOrder() bool
CheckOrder checks whether the resourceBlock is sorted
func (*ResourceBlock) DefRange ¶
func (b *ResourceBlock) DefRange() hcl.Range
DefRange gets the definition range of the resource block
func (*ResourceBlock) ToString ¶
func (b *ResourceBlock) ToString() string
ToString prints the sorted resource block
type Section ¶
type Section interface { // CheckOrder checks whether the arguments in the collection is sorted CheckOrder() bool // ToString prints arguments in the collection in order ToString() string // GetRange returns the entire range of the argument collection GetRange() *hcl.Range }
Section is an interface offering general APIs of argument collections