fixer

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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 NewFixer

func NewFixer() *Fixer

NewFixer instantiates a Fixer.

func (*Fixer) Fix

func (*Fixer) GetFixForName

func (f *Fixer) GetFixForName(name string) (fixes.Fix, bool)

func (*Fixer) GetMandatoryFixForName added in v0.25.0

func (f *Fixer) GetMandatoryFixForName(name string) (fixes.Fix, bool)

func (*Fixer) RegisterFixes

func (f *Fixer) RegisterFixes(fixes ...fixes.Fix)

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

func (f *Fixer) RegisterMandatoryFixes(fixes ...fixes.Fix)

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

func (f *Fixer) RegisterRoots(roots ...string)

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.

func NewReport

func NewReport() *Report

func (*Report) AddFileFix added in v0.26.0

func (r *Report) AddFileFix(file string, fix fixes.FixResult)

func (*Report) FixedFiles

func (r *Report) FixedFiles() []string

func (*Report) FixesForFile added in v0.26.0

func (r *Report) FixesForFile(file string) []fixes.FixResult

func (*Report) HasConflicts added in v0.28.0

func (r *Report) HasConflicts() bool

func (*Report) MergeFixes added in v0.26.0

func (r *Report) MergeFixes(path1, path2 string)

func (*Report) OldPathForFile added in v0.26.0

func (r *Report) OldPathForFile(newPath string) (string, bool)

func (*Report) RegisterConflictManyToOne added in v0.28.0

func (r *Report) RegisterConflictManyToOne(root, newPath, oldPath string)

func (*Report) RegisterConflictSourceFile added in v0.28.0

func (r *Report) RegisterConflictSourceFile(root, newPath, oldPath string)

func (*Report) RegisterOldPathForFile added in v0.26.0

func (r *Report) RegisterOldPathForFile(newPath, oldPath string)

func (*Report) TotalFixes

func (r *Report) TotalFixes() uint

type Reporter

type Reporter interface {
	Report(*Report) error
	SetDryRun(bool)
}

Reporter is responsible for outputting a fix report in a specific format.

func ReporterForFormat

func ReporterForFormat(format string, outputWriter io.Writer) (Reporter, error)

ReporterForFormat returns a suitable Reporter for outputting a fix report in the given format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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