-
Notifications
You must be signed in to change notification settings - Fork 104
Add --lint_mode flag for buildifier #192
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
Conversation
this requires vim-codefmt PR 192 merged google/vim-codefmt#192
|
Wouldn't it be better to by default not pass any mode override at all? This would be another layer of defaulting that could fight with other local config settings, etc. |
|
I'm passing the default value though, so that will do exactly the same. Anyway, I like being explicit about the lint_mode. If this could fight with other local config settings, that means you're saying the lint_mode can already be specified in some other way, and the whole PR would be unnecessary. As far as I know, that's not the case, but if so, please elaborate on how to do that. |
|
I don't know whether buildifier would have any other override mechanism in practice or not, just that I prefer not to copy-paste defaults. IOW, you're saying it will do the same because you're passing the same default value… what if they change the default later, like add a new middle option for minimal fixes and make that the default? Would we want this default to take precedence over theirs? |
|
okay fair enough. so it should be changed to have the empty string as the default, and an if-statement added to not add the parameter in that case. |
|
Okay, fixed that. Also tested and specified in the help message what the behaviour is for 'warn', since it is possible someone would actually choose that behaviour. |
autoload/codefmt/buildifier.vim
Outdated
| let l:lint_flag = s:plugin.Flag('buildifier_lint_mode') | ||
| let l:cmd = [ s:plugin.Flag('buildifier_executable') ] | ||
| if l:lint_flag != "" | ||
| let l:cmd += ["--lint=" .. l:lint_flag] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this .. a typo intended to be .? AFAICT it blows up with an error on my version of vim.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How strange! I'm using NeoVim and always used two dots to concatenate strings, I never knew one dot sufficed. It's fixed now.
|
Thanks for working with me on the defaults! Looks good now besides one |
In your vimrc you can do e.g. call glaive#Install() Glaive codefmt buildifier_lint_mode='fix' to get buildifier to autofix issues. The default behaviour is unchanged.
|
Merged, thanks! |
In your vimrc you can do e.g.
to get buildifier to autofix issues. The default behaviour is unchanged.