codemod

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyEdits

func ApplyEdits(edits []Edit) (applied int, filesModified int, err error)

Types

type Edit

type Edit struct {
	File        string
	StartByte   int
	EndByte     int
	Replacement string
}

func EditsForFile

func EditsForFile(path string, recipe Recipe) ([]Edit, error)

type Recipe

type Recipe struct {
	Name        string `yaml:"name"`
	Language    string `yaml:"language"`
	Match       string `yaml:"match"`
	Replacement string `yaml:"replacement"`
}

func LoadRecipe

func LoadRecipe(path string) (Recipe, error)

func (Recipe) Validate

func (r Recipe) Validate() error

type Result

type Result struct {
	Matches       int
	FilesMatched  int
	EditsApplied  int
	FilesModified int
	Edits         []Edit
}

func Run

func Run(root string, recipe Recipe, apply bool) (Result, error)

Jump to

Keyboard shortcuts

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