diff --git a/cmd/tools/vtest-cleancode.v b/cmd/tools/vtest-cleancode.v index d2ecca4c44..90194192f1 100644 --- a/cmd/tools/vtest-cleancode.v +++ b/cmd/tools/vtest-cleancode.v @@ -74,9 +74,11 @@ const ( ] ) -const vexe = os.getenv('VEXE') - -const vroot = os.dir(vexe) +const ( + vexe = os.getenv('VEXE') + vroot = os.dir(vexe) + is_fix = '-fix' in os.args +) fn main() { args_string := os.args[1..].join(' ') @@ -101,8 +103,8 @@ fn tsession(vargs string, tool_source string, tool_cmd string, tool_args string, fn v_test_vetting(vargs string) { vet_session := tsession(vargs, 'vvet', 'v vet', 'vet', vet_folders, vet_known_failing_exceptions) - verify_session := tsession(vargs, 'vfmt.v', 'v fmt -verify', 'fmt -verify', vfmt_verify_list, - verify_known_failing_exceptions) + fmt_cmd, fmt_args := if is_fix { 'v fmt -w', 'fmt -w' } else { 'v fmt -verify', 'fmt -verify' } + verify_session := tsession(vargs, 'vfmt.v', fmt_cmd, fmt_args, vfmt_verify_list, verify_known_failing_exceptions) // if vet_session.benchmark.nfail > 0 || verify_session.benchmark.nfail > 0 { eprintln('\n')