Skip to content

Commit 2d12e54

Browse files
committed
clean message checking
1 parent 48d1f01 commit 2d12e54

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

pyls/plugins/importmagic_lint.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,16 @@ def pyls_code_actions(config, document, context):
154154
for diagnostic in diagnostics:
155155
if diagnostic.get('source') != SOURCE:
156156
continue
157+
157158
message = diagnostic.get('message', '')
158-
if message.startswith('Unreferenced'):
159-
m = UNREF_RE.match(message)
160-
if not m:
161-
continue
162-
unref = m.group('unreferenced')
159+
unref_match = UNREF_RE.match(message)
160+
unres_match = UNRES_RE.match(message)
161+
162+
if unref_match:
163+
unref = unref_match.group('unreferenced')
163164
actions.append(_generate_remove_action(document, index, unref))
164-
elif message.startswith('Unresolved'):
165-
m = UNRES_RE.match(message)
166-
if not m:
167-
continue
168-
unres = m.group('unresolved')
165+
elif unres_match:
166+
unres = unres_match.group('unresolved')
169167
actions.extend(_get_actions_for_unres(document, index, min_score, unres))
170168

171169
return actions

0 commit comments

Comments
 (0)