Skip to content

Conversation

@TamaMcGlinn
Copy link
Contributor

@TamaMcGlinn TamaMcGlinn commented Jul 11, 2022

In your vimrc you can do e.g.

call glaive#Install()
Glaive codefmt buildifier_lint_mode='fix'
Glaive codefmt buildifier_warnings='-module-docstring,+unsorted-dict-items'

to get buildifier to ignore missing module docstrings but sort
dictionaries automatically. The default behaviour is unchanged.

endif
let l:warnings_flag = s:plugin.Flag('buildifier_warnings')
if l:warnings_flag != ""
let l:cmd += ["--warnings=" . l:warnings_flag]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if there are spaces in the flag value this will do the right thing since maktaba#syscall will do escaping, but could you verify?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean by 'the right thing', since spaces are not allowed in this flag. I could add a check and throw an error in that case, but then the question arises; why not check all other invalid characters as well?

I tried this:

Glaive codefmt buildifier_lint_mode='' buildifier_warnings='+unsorted-dict-items --lint=invalid'

and it just ignores the invalid flag - so I guess it must be inserting a backslash before the space and therefore not passing --line=invalid as a separate argument. If we later add a flag that is allowed to contain spaces, this should do the right thing.

In your vimrc you can do e.g.

call glaive#Install()
Glaive codefmt buildifier_lint_mode='fix'
Glaive codefmt buildifier_warnings='-module-docstring,+unsorted-dict-items'

to get buildifier to ignore missing module docstrings but sort
dictionaries automatically. The default behaviour is unchanged.
@dbarnett
Copy link
Contributor

Thanks! Merging.

@dbarnett dbarnett merged commit 7a1483f into google:master Jul 28, 2022
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

Successfully merging this pull request may close these issues.

2 participants