Browse Source

Rename regex -> regexp

Vadim Markovtsev 6 years ago
parent
commit
ab152547fe
2 changed files with 8 additions and 7 deletions
  1. 7 6
      internal/plumbing/tree_diff.go
  2. 1 1
      internal/plumbing/tree_diff_test.go

+ 7 - 6
internal/plumbing/tree_diff.go

@@ -2,12 +2,13 @@ package plumbing
 
 import (
 	"fmt"
-	"gopkg.in/src-d/enry.v1"
 	"io"
 	"log"
 	"regexp"
 	"strings"
 
+	"gopkg.in/src-d/enry.v1"
+
 	"gopkg.in/src-d/go-git.v4"
 	"gopkg.in/src-d/go-git.v4/plumbing"
 	"gopkg.in/src-d/go-git.v4/plumbing/object"
@@ -47,9 +48,9 @@ const (
 	// allLanguages denotes passing all files in.
 	allLanguages = "all"
 
-	// ConfigTreeDiffFilterRegex is the name of the configuration option
+	// ConfigTreeDiffFilterRegexp is the name of the configuration option
 	// (TreeDiff.Configure()) which makes FileDiff consider only those files which have names matching this regexp.
-	ConfigTreeDiffFilterRegex = "TreeDiff.FilteredRegexes"
+	ConfigTreeDiffFilterRegexp = "TreeDiff.FilteredRegexes"
 )
 
 // defaultBlacklistedPrefixes is the list of file path prefixes which should be skipped by default.
@@ -106,8 +107,8 @@ func (treediff *TreeDiff) ListConfigurationOptions() []core.ConfigurationOption
 		Type:    core.StringsConfigurationOption,
 		Default: []string{allLanguages}}, {
 
-		Name:        ConfigTreeDiffFilterRegex,
-		Description: "Whitelist Regex to determine which files to analyze",
+		Name:        ConfigTreeDiffFilterRegexp,
+		Description: "Whitelist regexp to determine which files to analyze.",
 		Flag:        "whitelist",
 		Type:        core.StringConfigurationOption,
 		Default:     ""},
@@ -130,7 +131,7 @@ func (treediff *TreeDiff) Configure(facts map[string]interface{}) {
 		treediff.Languages[allLanguages] = true
 	}
 
-	if val, exists := facts[ConfigTreeDiffFilterRegex].(string); exists {
+	if val, exists := facts[ConfigTreeDiffFilterRegexp].(string); exists {
 		treediff.NameFilter = regexp.MustCompile(val)
 	}
 }

+ 1 - 1
internal/plumbing/tree_diff_test.go

@@ -164,7 +164,7 @@ func TestTreeDiffConsumeOnlyFilesThatMatchFilter(t *testing.T) {
 	td = fixtureTreeDiff()
 	td.previousTree, _ = prevCommit.Tree()
 	td.Configure(map[string]interface{}{
-		ConfigTreeDiffFilterRegex: ".*go",
+		ConfigTreeDiffFilterRegexp: ".*go",
 	})
 	res, err = td.Consume(deps)
 	assert.Nil(t, err)