Documentation ¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func CheckCommand(c *cli.Context) error
- func CheckDirectoryForConfigFile(dir string) bool
- func ContainsString(haystack []string, needle string) bool
- func ConvertWildcardPatternToGoRegexp(pattern string) *regexp.Regexp
- func CreateCliApp() *cli.App
- func CreateSourceFileExtensionRegex(fileExtensions []string) *regexp.Regexp
- func ExitBecauseOfInternalError(err string)
- func FindSourceFiles(searchPaths []string) ([]string, error)
- func FixCommand(c *cli.Context) error
- func FixEndOfLineRule(ruleValue string, fileContent string) string
- func FixInsertFinalNewLineRule(ruleValue string, fileContent string) string
- func FixMixedIndentationToSpaces(ruleValueNumberOfSpaces string, line string) string
- func FixTabIndentationToSpaces(ruleValueNumberOfSpaces string, line string) string
- func FixTrimTrailingWhitespaceRule(ruleValue string, line string) string
- func FixUndividableIndentationToNearestSpacesAmount(ruleValueNumberOfSpaces string, line string) string
- func GetConfigFilePathInDirectory(dir string) string
- func GetErrorWithLineBreaksVisible(s string) string
- func GetNumberOfLeftSpaces(s string) int
- func GetParentDir(path string) string
- func GetRulesToApplyToSourcePath(sourcePath string, cfs []ConfigFile) map[string]string
- func GetSourceFileExtensions() []string
- func HasIndentation(s string) bool
- func HasNoIndentation(s string) bool
- func IsIndentedWithMixedTabsAndSpaces(s string) bool
- func IsIndentedWithSpaces(s string) bool
- func IsIndentedWithTabs(s string) bool
- func IsIndentedWithTabsThenCommentLine(s string) bool
- func LsCommand(c *cli.Context) error
- func MustAsset(name string) []byte
- func MustGetFileAsString(path string) string
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func RulesCommand(c *cli.Context) error
- func SplitIntoLines(s string) []string
- type ByPrecedence
- type ConfigFile
- type FileConstrainedRuleSet
- type FullFileCheckResult
- type FullFileChecker
- type FullFileFixer
- type LineCheckResult
- type LineChecker
- type LineFixer
- type Rule
- type RuleSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
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 ¶
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 ¶
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 CheckCommand ¶
func ContainsString ¶
func CreateCliApp ¶
func ExitBecauseOfInternalError ¶
func ExitBecauseOfInternalError(err string)
func FindSourceFiles ¶
func FixCommand ¶
func FixEndOfLineRule ¶
func FixInsertFinalNewLineRule ¶
*
- This must be called before FixEndOfLineRule so the \n added will be converted to whatever the
- 'end_of_line' rule dictates.
func GetNumberOfLeftSpaces ¶
func GetParentDir ¶
func GetRulesToApplyToSourcePath ¶
func GetRulesToApplyToSourcePath(sourcePath string, cfs []ConfigFile) map[string]string
func GetSourceFileExtensions ¶
func GetSourceFileExtensions() []string
func HasIndentation ¶
func HasNoIndentation ¶
func IsIndentedWithSpaces ¶
func IsIndentedWithTabs ¶
func IsIndentedWithTabsThenCommentLine ¶
This allows comments like /**\n\t *\n\t */
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func MustGetFileAsString ¶
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func RulesCommand ¶
func SplitIntoLines ¶
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 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 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 RuleSet ¶
type RuleSet []Rule