Skip to content

Commit 91a1368

Browse files
Resolve flake8_executable allowing ~/${HOME} paths (palantir#869)
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
1 parent 3af83fe commit 91a1368

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pyls/plugins/flake8_lint.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2019 Palantir Technologies, Inc.
22
"""Linter pluging for flake8"""
33
import logging
4-
from os import path
4+
import os.path
55
import re
66
from subprocess import Popen, PIPE
77
from pyls import hookimpl, lsp
@@ -34,8 +34,8 @@ def pyls_lint(workspace, document):
3434

3535
# flake takes only absolute path to the config. So we should check and
3636
# convert if necessary
37-
if opts.get('config') and not path.isabs(opts.get('config')):
38-
opts['config'] = path.abspath(path.expanduser(path.expandvars(
37+
if opts.get('config') and not os.path.isabs(opts.get('config')):
38+
opts['config'] = os.path.abspath(os.path.expanduser(os.path.expandvars(
3939
opts.get('config')
4040
)))
4141
log.debug("using flake8 with config: %s", opts['config'])
@@ -56,6 +56,12 @@ def run_flake8(flake8_executable, args, document):
5656
args = [(i if not i.startswith('--ignore=') else FIX_IGNORES_RE.sub('', i))
5757
for i in args if i is not None]
5858

59+
# if executable looks like a path resolve it
60+
if not os.path.isfile(flake8_executable) and os.sep in flake8_executable:
61+
flake8_executable = os.path.abspath(
62+
os.path.expanduser(os.path.expandvars(flake8_executable))
63+
)
64+
5965
log.debug("Calling %s with args: '%s'", flake8_executable, args)
6066
try:
6167
cmd = [flake8_executable]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy