section

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AliasType = "alias"
View Source
const BlankType = "blank"
View Source
const CustomSeparator = ","

CustomSeparator allows you to group multiple custom prefix together in the same section gci diff -s standard -s default -s prefix(github.com/company,gitlab.com/company,companysuffix)

View Source
const CustomType = "custom"
View Source
const DefaultType = "default"
View Source
const DotType = "dot"
View Source
const LocalModuleType = "localmodule"
View Source
const StandardType = "standard"

Variables

View Source
var (
	MissingImportStatementError   = FileParsingError{errors.New("no import statement present in File")}
	ImportStatementNotClosedError = FileParsingError{errors.New("import statement not closed")}
)
View Source
var MissingParameterClosingBracketsError = fmt.Errorf("section parameter is missing closing %q", utils.RightParenthesis)
View Source
var MoreThanOneOpeningQuotesError = fmt.Errorf("found more than one %q parameter start sequences", utils.RightParenthesis)
View Source
var SectionTypeDoesNotAcceptParametersError = errors.New("section type does not accept a parameter")
View Source
var SectionTypeDoesNotAcceptPrefixError = errors.New("section may not contain a Prefix")
View Source
var SectionTypeDoesNotAcceptSuffixError = errors.New("section may not contain a Suffix")

Functions

This section is empty.

Types

type Alias

type Alias struct{}

func (Alias) MatchSpecificity

func (b Alias) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Alias) String

func (b Alias) String() string

func (Alias) Type

func (b Alias) Type() string

type Blank

type Blank struct{}

func (Blank) MatchSpecificity

func (b Blank) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Blank) String

func (b Blank) String() string

func (Blank) Type

func (b Blank) Type() string

type CommentLine

type CommentLine struct {
	Comment string
}

func (CommentLine) MatchSpecificity

func (c CommentLine) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (CommentLine) String

func (c CommentLine) String() string

func (CommentLine) Type

func (c CommentLine) Type() string

type Custom

type Custom struct {
	Prefix string
}

func (Custom) MatchSpecificity

func (c Custom) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Custom) String

func (c Custom) String() string

func (Custom) Type

func (c Custom) Type() string

type Default

type Default struct{}

func (Default) MatchSpecificity

func (d Default) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Default) String

func (d Default) String() string

func (Default) Type

func (d Default) Type() string

type Dot

type Dot struct{}

func (Dot) MatchSpecificity

func (d Dot) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Dot) String

func (d Dot) String() string

func (Dot) Type

func (d Dot) Type() string

type EqualSpecificityMatchError

type EqualSpecificityMatchError struct {
	Imports            *parse.GciImports
	SectionA, SectionB Section
}

func (EqualSpecificityMatchError) Error

func (EqualSpecificityMatchError) Is

type FileParsingError

type FileParsingError struct {
	// contains filtered or unexported fields
}

func (FileParsingError) Is

func (f FileParsingError) Is(err error) bool

func (FileParsingError) Unwrap

func (f FileParsingError) Unwrap() error

type InvalidAliasSplitError

type InvalidAliasSplitError struct {
	// contains filtered or unexported fields
}

func (InvalidAliasSplitError) Error

func (i InvalidAliasSplitError) Error() string

func (InvalidAliasSplitError) Is

func (i InvalidAliasSplitError) Is(err error) bool

type InvalidImportSplitError

type InvalidImportSplitError struct {
	// contains filtered or unexported fields
}

func (InvalidImportSplitError) Error

func (i InvalidImportSplitError) Error() string

func (InvalidImportSplitError) Is

type LocalModule

type LocalModule struct {
	Paths []string
}

func (*LocalModule) Configure

func (m *LocalModule) Configure() error

Configure configures the module section by finding the module for the current path

func (*LocalModule) MatchSpecificity

func (m *LocalModule) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (*LocalModule) String

func (m *LocalModule) String() string

func (*LocalModule) Type

func (m *LocalModule) Type() string

type NewLine

type NewLine struct{}

func (NewLine) MatchSpecificity

func (n NewLine) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (NewLine) String

func (n NewLine) String() string

func (NewLine) Type

func (n NewLine) Type() string

type NoMatchingSectionForImportError

type NoMatchingSectionForImportError struct {
	Imports *parse.GciImports
}

func (NoMatchingSectionForImportError) Error

func (NoMatchingSectionForImportError) Is

type Section

type Section interface {
	// MatchSpecificity returns how well an Import matches to this Section
	MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

	// String Implements the stringer interface
	String() string

	// return section type
	Type() string
}

Section defines a part of the formatted output.

type SectionList

type SectionList []Section

func DefaultSectionSeparators

func DefaultSectionSeparators() SectionList

func DefaultSections

func DefaultSections() SectionList

func Parse

func Parse(data []string) (SectionList, error)

func (SectionList) String

func (list SectionList) String() []string

type SectionParsingError

type SectionParsingError struct {
	// contains filtered or unexported fields
}

func (SectionParsingError) Is

func (s SectionParsingError) Is(err error) bool

func (SectionParsingError) Unwrap

func (s SectionParsingError) Unwrap() error

func (SectionParsingError) Wrap

func (s SectionParsingError) Wrap(sectionStr string) error

type Standard

type Standard struct{}

func (Standard) MatchSpecificity

func (s Standard) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Standard) String

func (s Standard) String() string

func (Standard) Type

func (s Standard) Type() string

Jump to

Keyboard shortcuts

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