Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fix ¶
type Fix interface { // Name returns the unique name for the fix, this should correlate with the // violation title & rule name that the fix is meant to address. Name() string Fix(fc *FixCandidate, opts *RuntimeOptions) ([]FixResult, error) }
Fix is the interface that must be implemented by all fixes.
func NewDefaultFixes ¶
func NewDefaultFixes() []Fix
NewDefaultFixes returns a list of default fixes that are applied by the fix command. When a new fix is added, it should be added to this list.
type FixCandidate ¶
FixCandidate is the input to a Fix method and represents a file in need of fixing.
type FixResult ¶
type FixResult struct {
Contents []byte
}
FixResult is returned from the Fix method and contains the new contents or fix recommendations. In future this might support diff based updates, or renames.
type Fmt ¶
type Fmt struct { // NameOverride allows this fix config to also be registered under another name, see note // in Name(). NameOverride string // OPAFmtOpts are the options to pass to OPA's format.SourceWithOpts // function. OPAFmtOpts format.Opts }
func (*Fmt) Fix ¶
func (f *Fmt) Fix(fc *FixCandidate, _ *RuntimeOptions) ([]FixResult, error)
type NoWhitespaceComment ¶
type NoWhitespaceComment struct{}
func (*NoWhitespaceComment) Fix ¶
func (*NoWhitespaceComment) Fix(fc *FixCandidate, opts *RuntimeOptions) ([]FixResult, error)
func (*NoWhitespaceComment) Name ¶
func (*NoWhitespaceComment) Name() string
type RuntimeOptions ¶
RuntimeOptions are the options that are passed to the Fix method when the Fix is executed. Location based fixes will have the locations populated by the caller.
type UseAssignmentOperator ¶
type UseAssignmentOperator struct{}
func (*UseAssignmentOperator) Fix ¶
func (*UseAssignmentOperator) Fix(fc *FixCandidate, opts *RuntimeOptions) ([]FixResult, error)
func (*UseAssignmentOperator) Name ¶
func (*UseAssignmentOperator) Name() string
Click to show internal directories.
Click to hide internal directories.