Fix sanitizing config lines (#50553)

Previously, the index got out of sync with the actual config list. Invoked with lines:
  - bad
  - first
  - bad
  - second
the sanitization would first delete index 0 and then index 2, which would result in the output
  - first
  - bad
By reversing the list, we avoid that problem (though a filter() would be nicer)
pull/50724/head
Jan-Philipp Litza 6 years ago committed by Nathaniel Case
parent cb89b1758d
commit 636e1d5fcb

@ -207,7 +207,7 @@ def diff_config(commands, config):
def sanitize_config(config, result):
result['filtered'] = list()
for regex in CONFIG_FILTERS:
for index, line in enumerate(list(config)):
for index, line in reversed(list(enumerate(config))):
if regex.search(line):
result['filtered'].append(line)
del config[index]

Loading…
Cancel
Save