source: Consolidate if conditions
authorsrinivasreddy <thatiparthysreenivas@gmail.com>
Mon, 21 Mar 2016 16:22:27 +0000 (21:52 +0530)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 22 Mar 2016 18:49:16 +0000 (19:49 +0100)
source/filesystem.go

index 66270c5890a5e734c14e778614928679b844f6f2..053081a7a9bf787b5d3197a5726a0b4666b656a6 100644 (file)
@@ -143,18 +143,11 @@ func (f *Filesystem) avoid(filePath string) bool {
 
 func isNonProcessablePath(filePath string) bool {
        base := filepath.Base(filePath)
-       if base[0] == '.' {
+       if strings.HasPrefix(base, ".") ||
+               strings.HasPrefix(base, "#") ||
+               strings.HasSuffix(base, "~") {
                return true
        }
-
-       if base[0] == '#' {
-               return true
-       }
-
-       if base[len(base)-1] == '~' {
-               return true
-       }
-
        ignoreFiles := viper.GetStringSlice("IgnoreFiles")
        if len(ignoreFiles) > 0 {
                for _, ignorePattern := range ignoreFiles {