summaryrefslogtreecommitdiff
path: root/lint.py
diff options
context:
space:
mode:
authorSylvain <syt@logilab.fr>2007-02-09 09:26:55 +0100
committerSylvain <syt@logilab.fr>2007-02-09 09:26:55 +0100
commit720c3b8b264ac9777ebb0caa64fc7a3297a4a5af (patch)
tree0ad71bee21c5733d186be3c386349ad2ea4f8e80 /lint.py
parent4f582ef30277c409ec02a63c1a7ae5b4560c6804 (diff)
downloadpylint-720c3b8b264ac9777ebb0caa64fc7a3297a4a5af.tar.gz
apply ddrake patch
Diffstat (limited to 'lint.py')
-rw-r--r--lint.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/lint.py b/lint.py
index 551e073..00ebb71 100644
--- a/lint.py
+++ b/lint.py
@@ -738,14 +738,22 @@ def preprocess_options(args, search_for):
values of <search_for> are callback functions to call when the option is
found
"""
+ # Deleting from args on-the-fly while enumerating screws things up
+ # (indices get shifted, etc). To avoid problems, we create a list of
+ # indices to delete, and then do the deletions in reverse order after
+ # the argument processing has been completed.
+ to_del = []
for i, arg in enumerate(args):
for option in search_for:
if arg.startswith('--%s=' % option):
search_for[option](option, arg[len(option)+3:])
- del args[i]
+ to_del.append(i)
elif arg == '--%s' % option:
search_for[option](option, args[i + 1])
- del args[i:i+2]
+ to_del.extend([i, i+1])
+ to_del.reverse()
+ for i in to_del:
+ del args[i]
class Run:
"""helper class to use as main for pylint :