| 34 | } |
| 35 | |
| 36 | func ShouldIgnoreFile(filename string, cfg config.Config) bool { |
| 37 | for _, ignoredFile := range cfg.IgnoredFiles { |
| 38 | if filename == ignoredFile { |
| 39 | return true |
| 40 | } |
| 41 | if strings.HasSuffix(ignoredFile, "/") && strings.HasPrefix(filename, ignoredFile) { |
| 42 | return true |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | for _, pattern := range cfg.IgnoredPatterns { |
| 47 | matched, _ := filepath.Match(pattern, filepath.Base(filename)) |
| 48 | if matched { |
| 49 | return true |
| 50 | } |
| 51 | fullPattern := filepath.FromSlash(pattern) |
| 52 | matched, _ = filepath.Match(fullPattern, filename) |
| 53 | if matched { |
| 54 | return true |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | return false |
| 59 | } |