v test-cleancode: add -fix flag (#9364)
parent
29884fa2a9
commit
dad5a5e774
|
@ -74,9 +74,11 @@ const (
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
const vexe = os.getenv('VEXE')
|
const (
|
||||||
|
vexe = os.getenv('VEXE')
|
||||||
const vroot = os.dir(vexe)
|
vroot = os.dir(vexe)
|
||||||
|
is_fix = '-fix' in os.args
|
||||||
|
)
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
args_string := os.args[1..].join(' ')
|
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) {
|
fn v_test_vetting(vargs string) {
|
||||||
vet_session := tsession(vargs, 'vvet', 'v vet', 'vet', vet_folders, vet_known_failing_exceptions)
|
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,
|
fmt_cmd, fmt_args := if is_fix { 'v fmt -w', 'fmt -w' } else { 'v fmt -verify', 'fmt -verify' }
|
||||||
verify_known_failing_exceptions)
|
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 {
|
if vet_session.benchmark.nfail > 0 || verify_session.benchmark.nfail > 0 {
|
||||||
eprintln('\n')
|
eprintln('\n')
|
||||||
|
|
Loading…
Reference in New Issue