From a72704fbb46a1450b221028e411d9764e9deb23e Mon Sep 17 00:00:00 2001 From: thodnev Date: Tue, 30 Jun 2020 21:56:14 +0300 Subject: [PATCH] Parse ignore arguments in flake8 to avoid issues with Atom (#824) --- pyls/plugins/flake8_lint.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyls/plugins/flake8_lint.py b/pyls/plugins/flake8_lint.py index 9bd8ae26..698c1983 100644 --- a/pyls/plugins/flake8_lint.py +++ b/pyls/plugins/flake8_lint.py @@ -7,6 +7,7 @@ from pyls import hookimpl, lsp log = logging.getLogger(__name__) +FIX_IGNORES_RE = re.compile(r'([^a-zA-Z0-9_,]*;.*(\W+||$))') @hookimpl @@ -48,6 +49,9 @@ def run_flake8(args): """Run flake8 with the provided arguments, logs errors from stderr if any. """ + # a quick temporary fix to deal with Atom + args = [(i if not i.startswith('--ignore=') else FIX_IGNORES_RE.sub('', i)) + for i in args if i is not None] log.debug("Calling flake8 with args: '%s'", args) try: cmd = ['flake8']