Skip to content

Commit

Permalink
CDPCP-12516 - clean up unused functions prior implementing dead code …
Browse files Browse the repository at this point in the history
…check
  • Loading branch information
gregito committed Jul 24, 2024
1 parent a42ba6d commit 5f50112
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
- name: Go Coverage
uses: gwatts/go-coverage-action@v2.0.0
with:
coverage-threshold: 32.0
coverage-threshold: 31.8
cover-pkg: ./...
ignore-pattern: |
/cdp-sdk-go/
Expand Down
13 changes: 2 additions & 11 deletions cdp-sdk-go/cdp/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,16 @@
package cdp

import (
"strings"

datahubmodels "github.com/cloudera/terraform-provider-cdp/cdp-sdk-go/gen/datahub/models"
datalakemodels "github.com/cloudera/terraform-provider-cdp/cdp-sdk-go/gen/datalake/models"
environmentsmodels "github.com/cloudera/terraform-provider-cdp/cdp-sdk-go/gen/environments/models"
iammodels "github.com/cloudera/terraform-provider-cdp/cdp-sdk-go/gen/iam/models"
mlmodels "github.com/cloudera/terraform-provider-cdp/cdp-sdk-go/gen/ml/models"
opdbmodels "github.com/cloudera/terraform-provider-cdp/cdp-sdk-go/gen/opdb/models"
"strings"
)

// These functions should be generated in the appropriate gen package in an errors module.

func IsIamError(err *iammodels.Error, code string, message string) bool {
return err.Code == code && strings.Contains(err.Message, message)
}

func IsEnvironmentsError(err *environmentsmodels.Error, code string, message string) bool {
return err.Code == code && strings.Contains(err.Message, message)
}
Expand All @@ -41,7 +36,3 @@ func IsDatahubError(err *datahubmodels.Error, code string, message string) bool
func IsDatabaseError(err *opdbmodels.Error, code string, message string) bool {
return err.Code == code && strings.Contains(err.Message, message)
}

func IsMlError(err *mlmodels.Error, code string, message string) bool {
return err.Code == code && strings.Contains(err.Message, message)
}
File renamed without changes.
30 changes: 0 additions & 30 deletions utils/file_reader.go

This file was deleted.

89 changes: 0 additions & 89 deletions utils/file_reader_test.go

This file was deleted.

13 changes: 0 additions & 13 deletions utils/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,3 @@ func ContainsAsSubstring(slice []string, element string) bool {
}
return false
}

func ContainsEitherSubstring(slice []string, elements []string) bool {
if len(slice) > 0 && len(elements) > 0 {
for _, e := range slice {
for _, substring := range elements {
if strings.Contains(e, substring) {
return true
}
}
}
}
return false
}
18 changes: 17 additions & 1 deletion utils/slice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

package utils

import "testing"
import (
"strings"
"testing"
)

func TestContainsAsSubstring(t *testing.T) {
type input struct {
Expand Down Expand Up @@ -117,3 +120,16 @@ func TestContainsEitherSubstring(t *testing.T) {
})
}
}

func ContainsEitherSubstring(slice []string, elements []string) bool {
if len(slice) > 0 && len(elements) > 0 {
for _, e := range slice {
for _, substring := range elements {
if strings.Contains(e, substring) {
return true
}
}
}
}
return false
}
File renamed without changes.
File renamed without changes.

0 comments on commit 5f50112

Please sign in to comment.