Closed sandrodz closed 7 years ago
Aliases won't work. You have to either write a wrapper script and point g:syntastic_php_phpcs_exec
to it, or set g:syntastic_php_phpcs_exe
(not exec
) like this:
let g:syntastic_php_phpcs_exe = 'docker run -it --rm -v "$(pwd)":/app phpcs'
The first approach (a wrapper script) is preferred.
@lcd047 I tried your suggestion:
let g:syntastic_php_phpcs_exe = 'docker run -it --rm -v "$(pwd)":/app phpcs'
let g:syntastic_php_checkers = ['php', 'phpcs']
let g:syntastic_php_phpcs_args = '--standard=PSR2 -n'
but I still get:
Syntastic version: 3.8.0-14 (Vim 800, Darwin)
Info for filetype: php
Global mode: active
Filetype php is active
The current file will be checked automatically
Available checker: php
Currently enabled checker: php
Is there something else that needs to be done? reloaded?
Like I said: the preferred way is to do it with a wrapper script. Try that first. There are many problems with just changing the exe
.
@lcd047 okay you were right. But I don't see error notifications...
let g:syntastic_php_checkers = ['php', 'phpcs']
let g:syntastic_php_phpcs_exec = '/usr/local/bin/phpcs'
let g:syntastic_php_phpcs_args = '--standard=PSR2 -n'
/usr/local/bin/phpcs with x rights:
#!/bin/bash
docker run -it --rm -v "$(pwd)":/app phpcs "$@"
Syntastic version: 3.8.0-14 (Vim 800, Darwin)
Info for filetype: php
Global mode: active
Filetype php is active
The current file will be checked automatically
Available checkers: php phpcs
Currently enabled checkers: php phpcs
Problem now is that it doesn't show errors. I ran phpcs directly on the file and got many errors. But within vim nothing is displayed.
Maybe syntastic is not passing file name correctly to container?
You can enable debugging: set g:syntastic_debug
to 3, run the checker, then run :mes
.
Does this log make any sense to you?
yntastic: 29.965188: CacheErrors: Invoking checker: php/phpcs
syntastic: 29.965899: SyntasticMake: called with options: {'subtype': 'Style', 'errorformat': '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity%
.%#,"%f"\,%l\,%c\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]%.%#', 'makeprg': '/usr/local/bin/phpcs --standard=PSR2 -n --report=csv src/WeAreDe/Tbc
Pay/TbcPayProcessor.php'}
syntastic: 29.999856: system: command run in 0.033485s
syntastic: 30.000035: checker output: ['the input device is not a TTY', '']
syntastic: 30.000389: raw loclist: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'the input d
evice is not a TTY'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ''}]
syntastic: 30.000840: getLocList: checker php/phpcs returned 1
syntastic: 30.001042: php/phpcs raw: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'subtype': 'Style'
, 'text': 'the input device is not a TTY'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'subtype': '
Style', 'text': ''}]
syntastic: 30.001396: quiet_messages filter: {}
syntastic: 30.001600: getLocList: checker php/phpcs run in 0.036197s
syntastic: 30.001947: aggregated: {'_sorted': 0, '_name': '', '_owner': 1, '_columns': 1, '_rawLoclist': []}
"src/WeAreDe/TbcPay/TbcPayProcessor.php" 387L, 14966C written
syntastic: 136.628969: g:syntastic_version = '3.8.0-14 (Vim 800, Darwin)'
syntastic: 136.629230: &shell = '/bin/zsh', &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1
, &shellxquote = '', &autochdir = 0, &shellxescape = ''
syntastic: 136.629907: UpdateErrors (auto): default checkers
syntastic: 136.630413: CacheErrors: default checkers
syntastic: 136.631185: g:syntastic_aggregate_errors = 0
okay removing t worked:
#!/bin/bash
docker run -i --rm -v "$(pwd)":/app phpcs "$@"
the input device is not a TTY
was the hint
Does this log make any sense to you?
Absolutely.
syntastic: 29.965899: SyntasticMake: called with options: {'subtype': 'Style', 'errorformat': '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity% .%#,"%f"\,%l\,%c\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]%.%#', 'makeprg': '/usr/local/bin/phpcs --standard=PSR2 -n --report=csv src/WeAreDe/Tbc Pay/TbcPayProcessor.php'}
This is the command that got run:
/usr/local/bin/phpcs --standard=PSR2 -n --report=csv src/WeAreDe/Tbc
syntastic: 30.000035: checker output: ['the input device is not a TTY', '']
And this is the output:
the input device is not a TTY
@lcd047 thank you!
I tried to be as descriptive as possible, to help future googlers :)
I've phpcs setup inside docker container, with alias in .zshrc phpcs works like a command on machine.
in .zshrc
in .vimrc
But inside php file I get:
is there a way to make this setup work?