neoformat icon indicating copy to clipboard operation
neoformat copied to clipboard

path not correctly quoted in arguments passed to rubocop

Open d3v-null opened this issue 5 years ago • 1 comments

in https://github.com/sbdchd/neoformat/blob/master/autoload/neoformat/formatters/ruby.vim the formatter args are

{
        \ 'exe': 'rubocop',
        \ 'args': ['--auto-correct', '--stdin', '%:p', '2>/dev/null', '|', 'sed "1,/^====================$/d"'],
        \ 'stdin': 1,
}

However if the absolute path %:p contains a space, e.g. /Users/derwent/Google Drive/... then rubocop will fail with the message -s/--stdin requires exactly one path. and the buffer will be wiped.

The path should be escaped with quotes like this, which works for me.

let g:neoformat_ruby_rubocop = {
    \ 'exe': 'rubocop',
    \ 'args': [
    \   '--auto-correct', 
    \   '--stdin', 
    \   '"%:p"',
    \	'2>/dev/null',
    \	'|',
    \	'sed "1,/^====================$/d"'
    \ ],
    \ 'replace' : 0,
    \ 'stdin': 1,
    \ 'no_append': 1,
    \ }

d3v-null avatar Aug 03 '18 03:08 d3v-null

This looks like this was resolved by https://github.com/sbdchd/neoformat/commit/5ea3abc08f3f0db3600e9f6f36f096c64bffdc07

Might be OK to close?

jaydorsey avatar Dec 10 '18 16:12 jaydorsey