editorconfig

package
v0.0.0-...-472aaea Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2016 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func CheckCommand

func CheckCommand(c *cli.Context) error

func CheckDirectoryForConfigFile

func CheckDirectoryForConfigFile(dir string) bool

*

  • @return Whether or not to search parent directories.

func ContainsString

func ContainsString(haystack []string, needle string) bool

func ConvertWildcardPatternToGoRegexp

func ConvertWildcardPatternToGoRegexp(pattern string) *regexp.Regexp

func CreateCliApp

func CreateCliApp() *cli.App

func CreateSourceFileExtensionRegex

func CreateSourceFileExtensionRegex(fileExtensions []string) *regexp.Regexp

func ExitBecauseOfInternalError

func ExitBecauseOfInternalError(err string)

func FindSourceFiles

func FindSourceFiles(searchPaths []string) ([]string, error)

func FixCommand

func FixCommand(c *cli.Context) error

func FixEndOfLineRule

func FixEndOfLineRule(ruleValue string, fileContent string) string

func FixInsertFinalNewLineRule

func FixInsertFinalNewLineRule(ruleValue string, fileContent string) string

*

  • This must be called before FixEndOfLineRule so the \n added will be converted to whatever the
  • 'end_of_line' rule dictates.

func FixMixedIndentationToSpaces

func FixMixedIndentationToSpaces(ruleValueNumberOfSpaces string, line string) string

func FixTabIndentationToSpaces

func FixTabIndentationToSpaces(ruleValueNumberOfSpaces string, line string) string

func FixTrimTrailingWhitespaceRule

func FixTrimTrailingWhitespaceRule(ruleValue string, line string) string

func FixUndividableIndentationToNearestSpacesAmount

func FixUndividableIndentationToNearestSpacesAmount(ruleValueNumberOfSpaces string, line string) string

func GetConfigFilePathInDirectory

func GetConfigFilePathInDirectory(dir string) string

func GetErrorWithLineBreaksVisible

func GetErrorWithLineBreaksVisible(s string) string

func GetNumberOfLeftSpaces

func GetNumberOfLeftSpaces(s string) int

func GetParentDir

func GetParentDir(path string) string

func GetRulesToApplyToSourcePath

func GetRulesToApplyToSourcePath(sourcePath string, cfs []ConfigFile) map[string]string

func GetSourceFileExtensions

func GetSourceFileExtensions() []string

func HasIndentation

func HasIndentation(s string) bool

func HasNoIndentation

func HasNoIndentation(s string) bool

func IsIndentedWithMixedTabsAndSpaces

func IsIndentedWithMixedTabsAndSpaces(s string) bool

func IsIndentedWithSpaces

func IsIndentedWithSpaces(s string) bool

func IsIndentedWithTabs

func IsIndentedWithTabs(s string) bool

func IsIndentedWithTabsThenCommentLine

func IsIndentedWithTabsThenCommentLine(s string) bool

This allows comments like /**\n\t *\n\t */

func LsCommand

func LsCommand(c *cli.Context) error

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func MustGetFileAsString

func MustGetFileAsString(path string) string

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func RulesCommand

func RulesCommand(c *cli.Context) error

func SplitIntoLines

func SplitIntoLines(s string) []string

Types

type ByPrecedence

type ByPrecedence []ConfigFile

ByPrecedence implements sort.Interface for []ConfigFile based on how many slashes are in the file's path.

func (ByPrecedence) Len

func (a ByPrecedence) Len() int

func (ByPrecedence) Less

func (a ByPrecedence) Less(i, j int) bool

func (ByPrecedence) Swap

func (a ByPrecedence) Swap(i, j int)

type ConfigFile

type ConfigFile struct {
	Path                    string
	DefaultRuleSet          RuleSet
	FileConstrainedRuleSets []FileConstrainedRuleSet
}

func CreateConfigFileStruct

func CreateConfigFileStruct(path string) ConfigFile

func FilterConfigFilesToApplyToSourcePath

func FilterConfigFilesToApplyToSourcePath(sourcePath string, cfs []ConfigFile) []ConfigFile

func FindConfigFiles

func FindConfigFiles(sourceFilePaths []string) []ConfigFile

func SortConfigFilesByPrecendence

func SortConfigFilesByPrecendence(cfs []ConfigFile) []ConfigFile

*

  • @return Least important files first, most important files last.

func (*ConfigFile) Dir

func (cf *ConfigFile) Dir() string

func (*ConfigFile) IsRoot

func (cf *ConfigFile) IsRoot() bool

func (*ConfigFile) Precedence

func (cf *ConfigFile) Precedence() int

type FileConstrainedRuleSet

type FileConstrainedRuleSet struct {
	Constraint       string
	ConstraintRegexp *regexp.Regexp
	Rules            RuleSet
}

type FullFileCheckResult

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

func CheckCharsetRule

func CheckCharsetRule(ruleValue string, fileContent string) *FullFileCheckResult

func CheckEndOfLineRule

func CheckEndOfLineRule(ruleValue string, fileContent string) *FullFileCheckResult

func CheckInsertFinalNewLineRule

func CheckInsertFinalNewLineRule(ruleValue string, fileContent string) *FullFileCheckResult

type FullFileChecker

type FullFileChecker func(ruleValue string, fileContent string) *FullFileCheckResult

type FullFileFixer

type FullFileFixer func(ruleValue string, fileContent string) string

type LineCheckResult

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

func CheckIndentSizeRule

func CheckIndentSizeRule(ruleValue string, line string) *LineCheckResult

func CheckIndentStyleRule

func CheckIndentStyleRule(ruleValue string, line string) *LineCheckResult

func CheckTrimTrailingWhitespaceRule

func CheckTrimTrailingWhitespaceRule(ruleValue string, line string) *LineCheckResult

type LineChecker

type LineChecker func(ruleValue string, line string) *LineCheckResult

type LineFixer

type LineFixer func(ruleValue string, line string) string

type Rule

type Rule struct {
	Name  string
	Value string
}

type RuleSet

type RuleSet []Rule

func CreateRuleSetFromIniSecton

func CreateRuleSetFromIniSecton(section *ini.Section) RuleSet

func CreateRuleSetFromIniSectonName

func CreateRuleSetFromIniSectonName(ini *ini.File, name string) RuleSet

func (*RuleSet) Add

func (rs *RuleSet) Add(r Rule)

func (RuleSet) Get

func (rs RuleSet) Get(name string) string

Jump to

Keyboard shortcuts

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