akaihola/darker

Possibly wrong command line split behavior on Windows

akaihola opened this issue · 1 comments

A full linter command line can be provided to Darker, e.g.

darker --lint="mypy --strict" .

Splitting that command line into parts is done using shlex.split(), and on Windows the posix=False argument is added so backslashes as directory separators work correctly (todo: check this, not 100% sure).

This works otherwise as expected, but if there's a quoted parameter, the quotes don't get stripped properly:

>>> import shlex
>>> shlex.split('pylint --ignore "setup.py"'')
['pylint', '--ignore', '"setup.py"']  # on Windows

which is different from how it behaves on Unix.

A test xfail on Windows is added to test_check_linter_output() to mark this as a known issue but have the test suite still pass.

I'm not sure if the quotes are still removed correctly on Windows.

Moved to akaihola/graylint#27 together with the linting support implementation.