robcowie / SublimeTODO

**[DEPRECATED]** - See https://github.com/jonathandelgado/SublimeTodoReview - Extract TODO-type comments from open files and project folders
295 stars 54 forks source link

Exception when pattern in folder_exclude_patterns not found #29

Open niecw opened 12 years ago

niecw commented 12 years ago

When the folder_exclude_patterns is set with something that is not found, it will generate the following Traceback:

  File "./todo.py", line 289, in run
  File "./todo.py", line 226, in format
  File "./todo.py", line 169, in extract
  File "./todo.py", line 155, in filter_files
  File "./todo.py", line 143, in iter_files
ValueError: list.remove(x): x not in list

The following patch if applied to todo.py seems to "cure' it:

@@ -140,7 +140,7 @@
                 ## remove excluded dirs
                 for dir in [dir for dir in exclude_dirs if dir in dirnames]:
                     self.log.debug('Ignoring dir: {0}'.format(dir))
-                    dirnames.remove(dir)
+                    (dir in dirnames) and dirnames.remove(dir)

                 for filepath in filenames:
                     pth = path.join(dirpath, filepath)