hclreader

package
v0.0.0-...-d8feb33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type After

type After struct {
	Name string `hcl:"func,label"`
}

After is a block to check the specified function is called after the function of parent block is called.

type Before

type Before struct {
	Name    string   `hcl:"func,label"`
	Returns []string `hcl:"return,optional"`
}

Before is a block to check the specified function is called before the function of parent block is called.

type Config

type Config struct {
	Rules []Rule `hcl:"rule,block"`
}

Config has a slice of rule that defines the analyzer.

func Read

func Read(b []byte) (*Config, error)

Read inputs the path of file and read it as hcl.

type Func

type Func struct {
	Name     string   `hcl:"name,label"`
	Receiver *string  `hcl:"receiver,optional"`
	Befores  []Before `hcl:"before,block"`
	Afters   []After  `hcl:"after,block"`
}

Func is a block to check the function including method is properly used.

type Rule

type Rule struct {
	Name    string  `hcl:"name,label"`
	Package string  `hcl:"package"`
	Doc     string  `hcl:"doc"`
	Message *string `hcl:"message,optional"`
	Types   []Type  `hcl:"type,block"`
	Funcs   []Func  `hcl:"func,block"`
}

Rule has information to generate analyzer.

type Type

type Type struct {
	Name    string   `hcl:"name,label"`
	Shoulds []string `hcl:"should"`
}

Type is a block to check the value of type is properly used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL