File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -41,9 +41,13 @@ function! codefmt#buildifier#GetFormatter() abort
4141 function l: formatter .Format () abort
4242 let l: lint_flag = s: plugin .Flag (' buildifier_lint_mode' )
4343 let l: cmd = [ s: plugin .Flag (' buildifier_executable' ) ]
44- if l: lint_flag != " "
44+ if ! empty ( l: lint_flag)
4545 let l: cmd += [" --lint=" . l: lint_flag ]
4646 endif
47+ let l: warnings_flag = s: plugin .Flag (' buildifier_warnings' )
48+ if ! empty (l: warnings_flag )
49+ let l: cmd += [" --warnings=" . l: warnings_flag ]
50+ endif
4751 let l: fname = expand (' %:p' )
4852 if ! empty (l: fname )
4953 let l: cmd += [' -path' , l: fname ]
Original file line number Diff line number Diff line change @@ -117,6 +117,23 @@ Options:
117117 an error and do no formatting.
118118Default: '' `
119119
120+ *codefmt:buildifier_warnings*
121+ The warnings passed to buildifier to modify the defaults. Whatever is
122+ specified is added to the commandline after '--warnings='. For example, if you
123+ add this to your config:
124+
125+ Glaive codefmt buildifier_warnings='-module-docstring,+unsorted-dict-items'
126+
127+ Then buildifier will omit the 'module-docstring' warning, but add
128+ 'unsorted-dict-items' (which is ignored by default). This works also in
129+ fix-mode, in which case dictionary items will be resorted upon buffer save.
130+
131+ Options:
132+ "" (empty): Use default warnings from buildifier.
133+ "-some-warning": Remove 'some-warning' from the warning set.
134+ "+some-warning": Add 'some-warning' to the warning set.
135+ Default: ''
136+
120137 *codefmt:google_java_executable*
121138The path to the google-java executable. Generally, this should have the form:
122139`java -jar /path/to/google-java`
Original file line number Diff line number Diff line change @@ -111,6 +111,15 @@ call s:plugin.Flag('buildifier_executable', 'buildifier')
111111" cause an error and do no formatting.
112112call s: plugin .Flag (' buildifier_lint_mode' , ' ' )
113113
114+ " "
115+ " The warnings for buildifier. passed to buildifier --warnings parameter.
116+ "
117+ " Options:
118+ " " (empty): Use default warnings from buildifier.
119+ " -some-warning": Remove 'some-warning' from the warning set.
120+ " +some-warning": Add 'some-warning' to the warning set.
121+ call s: plugin .Flag (' buildifier_warnings' , ' ' )
122+
114123" "
115124" The path to the google-java executable. Generally, this should have the
116125" form:
You can’t perform that action at this time.
0 commit comments