Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶ added in v1.1.0
type Configuration struct {
// StrictAppend will do strict checking when assigning from append (x =
// append(x, y)). If this is set to true the append call must append either
// a variable assigned, called or used on the line above. Example on not
// allowed when this is true:
//
// x := []string{}
// y := "not going in X"
// x = append(x, "not y") // This is not allowed with StrictAppend
// z := "going in X"
//
// x = append(x, z) // This is allowed with StrictAppend
//
// m := transform(z)
// x = append(x, z) // So is this because Z is used above.
StrictAppend bool
// AllowAssignAndCallCuddle allows assignments to be cuddled with variables
// used in calls on line above and calls to be cuddled with assignments of
// variables used in call on line above.
// Example supported with this set to true:
//
// x.Call()
// x = Assign()
// x.AnotherCall()
// x = AnotherAssign()
AllowAssignAndCallCuddle bool
// AllowMultiLineAssignCuddle allows cuddling to assignments even if they
// span over multiple lines. This defaults to true which allows the
// following example:
//
// err := function(
// "multiple", "lines",
// )
// if err != nil {
// // ...
// }
AllowMultiLineAssignCuddle bool
// If the number of lines in a case block is equal to or lager than this
// number, the case *must* end white a newline.
CaseForceTrailingWhitespaceLimit int
// AllowTrailingComment will allow blocks to end with comments.
AllowTrailingComment bool
// AllowCuddleDeclaration will allow multiple var/declaration statements to
// be cuddled. This defaults to false but setting it to true will enable the
// following example:
// var foo bool
// var err error
AllowCuddleDeclaration bool
// AllowCuddleWithCalls is a list of call idents that everything can be
// cuddled with. Defaults to calls looking like locks to support a flow like
// this:
//
// mu.Lock()
// allow := thisAssignment
AllowCuddleWithCalls []string
// AllowCuddleWithRHS is a list of right hand side variables that is allowed
// to be cuddled with anything. Defaults to assignments or calls looking
// like unlocks to support a flow like this:
//
// allow := thisAssignment()
// mu.Unlock()
AllowCuddleWithRHS []string
// Backwards compatible filed due to failed release versioning of WSL. This
// is a no-op field. See https://github.com/bombsimon/wsl/issues/60
AllowCaseTrailingWhitespace bool
}
func DefaultConfig ¶ added in v1.2.0
func DefaultConfig() Configuration
DefaultConfig returns default configuration
type Processor ¶ added in v1.1.0
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessorWithConfig ¶ added in v1.1.0
func NewProcessorWithConfig(cfg Configuration) *Processor
NewProcessor will create a Processor.
Click to show internal directories.
Click to hide internal directories.