Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filereadable call to check config file swallows php-cs-fixer error #41

Open
yriveiro opened this issue Nov 11, 2017 · 0 comments
Open

Comments

@yriveiro
Copy link

This block of code has a side effect that it's tricky to debug.

if exists('g:php_cs_fixer_config_file') && filereadable(g:php_cs_fixer_config_file)
    if g:php_cs_fixer_version == 1
        let g:php_cs_fixer_command = g:php_cs_fixer_command . ' --config-file=' . g:php_cs_fixer_config_file
    else
        let g:php_cs_fixer_command = g:php_cs_fixer_command . ' --config=' . g:php_cs_fixer_config_file
    endif
endif

filereadable check result in the omission of an php-cs-fixer error saying that the config file it's not readable. I was spend 30 minutes to understand why my phpcs config file did not run properly in vim but executing command line ran without any problem.

I realise that I must use an absolute path to the config file and not a relative one to work properly. In case a misconfiguration like this, an error saying that file can't be loaded would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant