Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockOptions ¶ added in v0.5.0
type BlockOptions struct {
// contains filtered or unexported fields
}
func DefaultBlockOptions ¶ added in v0.5.0
func DefaultBlockOptions() BlockOptions
func ParseBlockOptions ¶ added in v0.5.0
func ParseBlockOptions(options string) (BlockOptions, error)
func (BlockOptions) String ¶ added in v0.5.0
func (opts BlockOptions) String() string
type Finding ¶
type Finding struct { // The name of the file that this finding is for. Path string `json:"path"` // The lines that this finding applies to. Lines LineRange `json:"lines"` // A human-readable message about what the finding is. Message string `json:"message"` // Possible fixes that could be applied to resolve the problem. // Each fix in this slice would independently fix the problem, they do not // and should not all be applied. // At most one of these Fixes may have Fix.automatic set to true. Fixes []Fix `json:"fixes"` }
Finding is something that keep-sorted thinks is wrong with a particular file.
type Fix ¶
type Fix struct { // The changes that should be made to the file to resolve the Finding. // All of these changes need to be made. Replacements []Replacement `json:"replacements"` // contains filtered or unexported fields }
Fix is a set of changes that could be made to resolve a Finding.
type Fixer ¶
type Fixer struct { ID string // contains filtered or unexported fields }
Fixer runs the business logic of keep-sorted.
func New ¶
func New(id string, defaultOptions BlockOptions) *Fixer
New creates a new fixer with the given string as its identifier. By default, id is "keep-sorted"
type LineRange ¶
LineRange is a 1-based range of continuous lines within a file. Both start and end are inclusive. You can designate a single line by setting start and end to the same line number.
func (LineRange) HighAtDimension ¶
func (LineRange) LowAtDimension ¶
func (LineRange) OverlapsAtDimension ¶
func (lr LineRange) OverlapsAtDimension(i augmentedtree.Interval, d uint64) bool
type Replacement ¶
type Replacement struct { // The lines that should be replaced with NewContent. Lines LineRange `json:"lines"` NewContent string `json:"new_content"` }
Replacement is a single substitution to apply to a file.
Click to show internal directories.
Click to hide internal directories.