Move reusable regexp constants to utils.go.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user