Browse Source

Option names skip -> enable

Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Maxim Sukharev 7 years ago
parent
commit
71340d9e41
2 changed files with 11 additions and 11 deletions
  1. 10 10
      tree_diff.go
  2. 1 1
      tree_diff_test.go

+ 10 - 10
tree_diff.go

@@ -13,18 +13,18 @@ import (
 // If "after" is nil, the change is a removal. Otherwise, it is a modification.
 // TreeDiff is a PipelineItem.
 type TreeDiff struct {
-	previousTree *object.Tree
 	SkipDirs     []string
+	previousTree *object.Tree
 }
 
 const (
 	// DependencyTreeChanges is the name of the dependency provided by TreeDiff.
 	DependencyTreeChanges = "changes"
-	// ConfigTreeDiffSkipBlacklist is the name of the configuration option
-	// (TreeDiff.Configure()) which allows to skip blacklist directories.
-	ConfigTreeDiffSkipBlacklist = "TreeDiff.SkipVendor"
+	// ConfigTreeDiffEnableBlacklist is the name of the configuration option
+	// (TreeDiff.Configure()) which allows to skip blacklisted directories.
+	ConfigTreeDiffEnableBlacklist = "TreeDiff.EnableBlacklist"
 	// ConfigTreeDiffBlacklistedDirs s the name of the configuration option
-	// (TreeDiff.Configure()) which allows to set blacklist directories.
+	// (TreeDiff.Configure()) which allows to set blacklisted directories.
 	ConfigTreeDiffBlacklistedDirs = "TreeDiff.BlacklistedDirs"
 )
 
@@ -53,13 +53,13 @@ func (treediff *TreeDiff) Requires() []string {
 // ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.
 func (treediff *TreeDiff) ListConfigurationOptions() []ConfigurationOption {
 	options := [...]ConfigurationOption{{
-		Name:        ConfigTreeDiffSkipBlacklist,
-		Description: "Skip blacklist directories.",
-		Flag:        "skip-blacklist",
+		Name:        ConfigTreeDiffEnableBlacklist,
+		Description: "Enable blacklisted directories.",
+		Flag:        "enable-blacklist",
 		Type:        BoolConfigurationOption,
 		Default:     false}, {
 		Name:        ConfigTreeDiffBlacklistedDirs,
-		Description: "List of blacklist directories. Separated by comma \",\".",
+		Description: "List of blacklisted directories. Separated by comma \",\".",
 		Flag:        "blacklisted-dirs",
 		Type:        StringsConfigurationOption,
 		Default:     defaultBlacklistedDirs},
@@ -69,7 +69,7 @@ func (treediff *TreeDiff) ListConfigurationOptions() []ConfigurationOption {
 
 // Configure sets the properties previously published by ListConfigurationOptions().
 func (treediff *TreeDiff) Configure(facts map[string]interface{}) {
-	if val, exists := facts[ConfigTreeDiffSkipBlacklist]; exists && val.(bool) == true {
+	if val, exist := facts[ConfigTreeDiffEnableBlacklist]; exist && val.(bool) {
 		treediff.SkipDirs = facts[ConfigTreeDiffBlacklistedDirs].([]string)
 	}
 }

+ 1 - 1
tree_diff_test.go

@@ -131,7 +131,7 @@ func TestTreeDiffConsumeSkip(t *testing.T) {
 	td = fixtureTreeDiff()
 	td.previousTree, _ = prevCommit.Tree()
 	td.Configure(map[string]interface{}{
-		ConfigTreeDiffSkipBlacklist:   true,
+		ConfigTreeDiffEnableBlacklist: true,
 		ConfigTreeDiffBlacklistedDirs: []string{"vendor/"},
 	})
 	res, err = td.Consume(deps)