deprecated

package
v0.0.0-...-8bd899d Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldRule

type FieldRule struct {
	// contains filtered or unexported fields
}

FieldRule will check usage of a deprecated field by field name.

func NewFieldRule

func NewFieldRule(fset *token.FileSet) *FieldRule

NewFieldRule will return a new deprecation rule for fields. Any field is used that is marked with the deprecated comment will emit an error.

func (*FieldRule) AddRules

func (r *FieldRule) AddRules(visitorRules *pepperlint.Rules)

AddRules will add the FieldRule to the given visitor

func (FieldRule) ValidateAssignStmt

func (r FieldRule) ValidateAssignStmt(stmt *ast.AssignStmt) error

ValidateAssignStmt will check to see if a deprecated field is being set or used.

func (FieldRule) ValidateBinaryExpr

func (r FieldRule) ValidateBinaryExpr(expr *ast.BinaryExpr) error

ValidateBinaryExpr will ensure that neither the LHS or RHS of the expr uses a deprecated field

func (FieldRule) ValidateCallExpr

func (r FieldRule) ValidateCallExpr(expr *ast.CallExpr) error

ValidateCallExpr will ensure that the deprecated field is not being passed as a parameter to a function or method.

func (FieldRule) ValidateIncDecStmt

func (r FieldRule) ValidateIncDecStmt(stmt *ast.IncDecStmt) error

ValidateIncDecStmt will ensure that deprecated fields that utilize ++ or -- will return an error.

func (*FieldRule) ValidatePackage

func (r *FieldRule) ValidatePackage(pkg *ast.Package) error

ValidatePackage will set the current package name to the package that is currently being visited.

func (FieldRule) ValidateRangeStmt

func (r FieldRule) ValidateRangeStmt(expr *ast.RangeStmt) error

ValidateRangeStmt will ensure that deprecated fields are not used within a range statement.

func (FieldRule) ValidateReturnStmt

func (r FieldRule) ValidateReturnStmt(stmt *ast.ReturnStmt) error

ValidateReturnStmt will ensure that the deprecated field is not being returned by any method or function.

func (*FieldRule) WithCache

func (r *FieldRule) WithCache(cache *pepperlint.Cache)

WithCache will create a new helper with the given cache. This is used to determine infomation about a specific ast.Node.

func (*FieldRule) WithFileSet

func (r *FieldRule) WithFileSet(fset *token.FileSet)

WithFileSet will set the token.FileSet to the rule allowing for more in depth errors.

type OpRule

type OpRule struct {
	// contains filtered or unexported fields
}

OpRule is used to walk and determine if an operation, whether function or method, being used is deprecated. If it is a deprecated operation, the appropriate error will be returned.

func NewOpRule

func NewOpRule(fset *token.FileSet) *OpRule

NewOpRule returns a new OpRule with the given file set.

func (*OpRule) AddRules

func (r *OpRule) AddRules(visitorRules *pepperlint.Rules)

AddRules will add the DeprecatedFieldRule to the given visitor

func (*OpRule) ValidateAssignStmt

func (r *OpRule) ValidateAssignStmt(stmt *ast.AssignStmt) error

ValidateAssignStmt will determine whether or not the RHS of an assignment expression contains any deprecated operation.

func (*OpRule) ValidateCallExpr

func (r *OpRule) ValidateCallExpr(expr *ast.CallExpr) error

ValidateCallExpr will determine if the operation in the CallExpr is deprecated.

func (*OpRule) ValidatePackage

func (r *OpRule) ValidatePackage(pkg *ast.Package) error

ValidatePackage is used to keep track of the current package scope that is being traversed.

func (*OpRule) WithCache

func (r *OpRule) WithCache(cache *pepperlint.Cache)

WithCache will create a new helper with the given cache. This is used to determine infomation about a specific ast.Node.

func (*OpRule) WithFileSet

func (r *OpRule) WithFileSet(fset *token.FileSet)

WithFileSet will set the token.FileSet to the rule allowing for more in depth errors.

type Rule

type Rule struct {
	// contains filtered or unexported fields
}

Rule is a container for all deprecated rules

func NewRule

func NewRule(fset *token.FileSet) *Rule

NewRule will return a new set of deprecated rules

func (*Rule) AddRules

func (r *Rule) AddRules(rules *pepperlint.Rules)

AddRules will add rules for every deprecate rule

func (Rule) CopyRule

func (r Rule) CopyRule() pepperlint.Rule

CopyRule satisfies the copy ruler interface to copy the current Rule

func (*Rule) WithCache

func (r *Rule) WithCache(cache *pepperlint.Cache)

WithCache will add rules for every deprecate rule

func (Rule) WithFileSet

func (r Rule) WithFileSet(fset *token.FileSet)

WithFileSet sets the file sets to each rule inside the deprecated rule container.

type StructRule

type StructRule struct {
	// contains filtered or unexported fields
}

StructRule will validate that no deprecated struct is used.

func NewStructRule

func NewStructRule(fset *token.FileSet) *StructRule

NewStructRule return a newly instantiated StructRule with the given file set.

func (*StructRule) AddRules

func (r *StructRule) AddRules(visitorRules *pepperlint.Rules)

AddRules will add the StructRule to the given visitor

func (StructRule) ValidateAssignStmt

func (r StructRule) ValidateAssignStmt(stmt *ast.AssignStmt) error

ValidateAssignStmt will take a look to see if a deprecated structure is being assigned to a given variable.

func (StructRule) ValidateBinaryExpr

func (r StructRule) ValidateBinaryExpr(expr *ast.BinaryExpr) error

ValidateBinaryExpr will ensure no deprecated struct is being used on either the LHS or RHS of the expression.

func (StructRule) ValidateCallExpr

func (r StructRule) ValidateCallExpr(expr *ast.CallExpr) error

ValidateCallExpr will ensure a deprecated struct is not being passed as a parameter

func (StructRule) ValidateFuncDecl

func (r StructRule) ValidateFuncDecl(decl *ast.FuncDecl) error

ValidateFuncDecl will validate function declaractions and ensure no deprecated structure is being used

func (*StructRule) ValidatePackage

func (r *StructRule) ValidatePackage(pkg *ast.Package) error

ValidatePackage will set the current package name to the package that is currently being visited.

func (StructRule) ValidateReturnStmt

func (r StructRule) ValidateReturnStmt(stmt *ast.ReturnStmt) error

ValidateReturnStmt will validate that return items are not deprecated structures.

func (StructRule) ValidateTypeSpec

func (r StructRule) ValidateTypeSpec(spec *ast.TypeSpec) error

ValidateTypeSpec will ensure that the type spec's type isn't a deprecated structure.

func (StructRule) ValidateValueSpec

func (r StructRule) ValidateValueSpec(spec *ast.ValueSpec) error

ValidateValueSpec will check structures used as values are not deprecated structs.

func (*StructRule) WithCache

func (r *StructRule) WithCache(cache *pepperlint.Cache)

WithCache will create a new helper with the given cache. This is used to determine infomation about a specific ast.Node.

func (*StructRule) WithFileSet

func (r *StructRule) WithFileSet(fset *token.FileSet)

WithFileSet will set the token.FileSet to the rule allowing for more in depth errors.

Jump to

Keyboard shortcuts

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