Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jortega0 committed Jul 20, 2024
1 parent 16fcc9f commit ec3741d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
3 changes: 1 addition & 2 deletions pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,13 @@ func stepsToTrigger(files []string, watch []WatchConfig) ([]Step, error) {
}
if !match {
include_files = append(include_files, f)
}
}
}
}
} else {
include_files = files
}


// Iterate over the filtered files for any matches
for _, i := range includes {
for _, f := range include_files {
Expand Down
23 changes: 10 additions & 13 deletions pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ func TestPipelinesStepsToTrigger(t *testing.T) {
Step: Step{Trigger: "txt"},
},
},
Expected: []Step{
},
Expected: []Step{},
},
"exclude double directory and extension wildcard": {
ChangedFiles: []string{
Expand All @@ -245,21 +244,19 @@ func TestPipelinesStepsToTrigger(t *testing.T) {
Step: Step{Trigger: "txt"},
},
},
Expected: []Step{
},
Expected: []Step{},
},
"excluded file changed": {
ChangedFiles: []string{
"watch-path-1/text2.txt",
},
WatchConfigs: []WatchConfig{
{
Paths: []string{"watch-path-1/*", "!watch-path-1/text2.txt" },
Paths: []string{"watch-path-1/*", "!watch-path-1/text2.txt"},
Step: Step{Trigger: "service-1"},
},
},
Expected: []Step{
},
Expected: []Step{},
},
"included and excluded files changed": {
ChangedFiles: []string{
Expand All @@ -270,11 +267,11 @@ func TestPipelinesStepsToTrigger(t *testing.T) {
},
WatchConfigs: []WatchConfig{
{
Paths: []string{"watch-path-1/*", "!watch-path-1/text2.txt" },
Paths: []string{"watch-path-1/*", "!watch-path-1/text2.txt"},
Step: Step{Trigger: "service-1"},
},
{
Paths: []string{"watch-path-1/*" },
Paths: []string{"watch-path-1/*"},
Step: Step{Trigger: "service-2"},
},
},
Expand All @@ -289,11 +286,11 @@ func TestPipelinesStepsToTrigger(t *testing.T) {
},
WatchConfigs: []WatchConfig{
{
Paths: []string{"watch-path-1/*", "!watch-path-1/text2.txt" },
Paths: []string{"watch-path-1/*", "!watch-path-1/text2.txt"},
Step: Step{Trigger: "service-1"},
},
{
Paths: []string{"watch-path-1/*" },
Paths: []string{"watch-path-1/*"},
Step: Step{Trigger: "service-2"},
},
},
Expand All @@ -308,7 +305,7 @@ func TestPipelinesStepsToTrigger(t *testing.T) {
},
WatchConfigs: []WatchConfig{
{
Paths: []string{"watch-path-1/**", "!watch-path-1/subdir2/**" },
Paths: []string{"watch-path-1/**", "!watch-path-1/subdir2/**"},
Step: Step{Trigger: "service-1"},
},
{
Expand All @@ -327,7 +324,7 @@ func TestPipelinesStepsToTrigger(t *testing.T) {
},
WatchConfigs: []WatchConfig{
{
Paths: []string{"watch-path-1/**", "!watch-path-1/subdir2/**" },
Paths: []string{"watch-path-1/**", "!watch-path-1/subdir2/**"},
Step: Step{Trigger: "service-1"},
},
{
Expand Down

0 comments on commit ec3741d

Please sign in to comment.