Move reusable regexp constants to utils.go.

This commit is contained in:
Amy Boyd
2016-07-04 13:49:43 +01:00
parent 26cdc12f86
commit 03eddbde0c
3 changed files with 13 additions and 15 deletions

View File

@@ -1,7 +1,6 @@
package editorconfig
import (
"regexp"
"strconv"
"strings"
)
@@ -23,13 +22,6 @@ type LineCheckResult struct {
messageIfNotOk string
}
var hasIndentationRegexp = regexp.MustCompile(`^[\t ]`)
var hasNoIndentationRegexp = regexp.MustCompile(`^([^\t ]|$)`)
var indentedWithMixedTabsAndSpacesRegexp = regexp.MustCompile(`^(\t+ +| +\t+)`)
var indentedWithTabsRegexp = regexp.MustCompile(`^\t+`)
var indentedWithTabsThenCommentLineRegexp = regexp.MustCompile(`^\t+ \*`)
var indentedWithSpacesRegexp = regexp.MustCompile(`^ +`)
func HasIndentation(s string) bool {
return hasIndentationRegexp.MatchString(s)
}