Documentation ¶
Index ¶
- type Fixer
- func (f *Fixer) Fix(ctx context.Context, l *linter.Linter, fp fileprovider.FileProvider) (*Report, error)
- func (f *Fixer) GetFixForName(name string) (fixes.Fix, bool)
- func (f *Fixer) GetMandatoryFixForName(name string) (fixes.Fix, bool)
- func (f *Fixer) RegisterFixes(fixes ...fixes.Fix)
- func (f *Fixer) RegisterMandatoryFixes(fixes ...fixes.Fix)
- func (f *Fixer) RegisterRoots(roots ...string)
- func (f *Fixer) SetOnConflictOperation(operation OnConflictOperation)
- type OnConflictOperation
- type PrettyReporter
- type Report
- func (r *Report) AddFileFix(file string, fix fixes.FixResult)
- func (r *Report) FixedFiles() []string
- func (r *Report) FixesForFile(file string) []fixes.FixResult
- func (r *Report) HasConflicts() bool
- func (r *Report) MergeFixes(path1, path2 string)
- func (r *Report) OldPathForFile(newPath string) (string, bool)
- func (r *Report) RegisterConflictManyToOne(root, newPath, oldPath string)
- func (r *Report) RegisterConflictSourceFile(root, newPath, oldPath string)
- func (r *Report) RegisterOldPathForFile(newPath, oldPath string)
- func (r *Report) TotalFixes() uint
- type Reporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fixer ¶
type Fixer struct {
// contains filtered or unexported fields
}
Fixer must be instantiated via NewFixer.
func (*Fixer) Fix ¶
func (f *Fixer) Fix(ctx context.Context, l *linter.Linter, fp fileprovider.FileProvider) (*Report, error)
func (*Fixer) GetMandatoryFixForName ¶ added in v0.25.0
func (*Fixer) RegisterFixes ¶
RegisterFixes sets the fixes that will be fixed if there are related linter violations that can be fixed by fixes.
func (*Fixer) RegisterMandatoryFixes ¶ added in v0.25.0
RegisterMandatoryFixes sets fixes which will be run before other registered fixes, against all files which are not ignored, regardless of linter violations.
func (*Fixer) RegisterRoots ¶ added in v0.26.0
RegisterRoots sets the roots of the files that will be fixed. Certain fixes may require the nearest root of the file to be known, as fix operations could involve things like moving files, which will be moved relative to their nearest root.
func (*Fixer) SetOnConflictOperation ¶ added in v0.28.0
func (f *Fixer) SetOnConflictOperation(operation OnConflictOperation)
SetOnConflictOperation sets the fixer's behavior when a conflict occurs.
type OnConflictOperation ¶ added in v0.28.0
type OnConflictOperation string
const ( OnConflictError OnConflictOperation = "error" OnConflictRename OnConflictOperation = "rename" )
type PrettyReporter ¶
type PrettyReporter struct {
// contains filtered or unexported fields
}
PrettyReporter outputs a fix report in a human-readable format.
func NewPrettyReporter ¶
func NewPrettyReporter(outputWriter io.Writer) *PrettyReporter
func (*PrettyReporter) Report ¶
func (r *PrettyReporter) Report(fixReport *Report) error
func (*PrettyReporter) ReportConflicts ¶ added in v0.28.0
func (r *PrettyReporter) ReportConflicts(fixReport *Report) error
func (*PrettyReporter) SetDryRun ¶ added in v0.26.0
func (r *PrettyReporter) SetDryRun(dryRun bool)
type Report ¶
type Report struct {
// contains filtered or unexported fields
}
Report contains updated file contents and summary information about the fixes that were applied during a fix operation.