checks.go 469 B

12345678910111213141516171819202122232425262728
  1. package main
  2. import (
  3. _ "fmt"
  4. "strings"
  5. )
  6. func checkRegex(diff string) ([]string, bool) {
  7. var match string
  8. var results []string
  9. secretsPresent := false
  10. lines := strings.Split(diff, "\n")
  11. for _, line := range lines {
  12. if len(line) == 0 {
  13. continue
  14. }
  15. for _, re := range regexes {
  16. match = re.FindString(line)
  17. if len(match) == 0 {
  18. continue
  19. }
  20. secretsPresent = true
  21. results = append(results, line)
  22. }
  23. }
  24. return results, secretsPresent
  25. }