vet: add -W flag and detailed help (#9331)
parent
6f550ebbdc
commit
39a9beb9e0
|
@ -32,6 +32,8 @@ const vet_options = cmdline.options_after(os.args, ['vet'])
|
||||||
|
|
||||||
const is_force = '-force' in vet_options
|
const is_force = '-force' in vet_options
|
||||||
|
|
||||||
|
const is_werror = '-W' in vet_options
|
||||||
|
|
||||||
const is_verbose = '-verbose' in vet_options || '-v' in vet_options
|
const is_verbose = '-verbose' in vet_options || '-v' in vet_options
|
||||||
|
|
||||||
const show_warnings = '-hide-warnings' !in vet_options
|
const show_warnings = '-hide-warnings' !in vet_options
|
||||||
|
@ -104,7 +106,7 @@ fn main() {
|
||||||
if errors_vfmt.len > 0 {
|
if errors_vfmt.len > 0 {
|
||||||
eprintln('NB: You can run `v fmt -w file.v` to fix these automatically')
|
eprintln('NB: You can run `v fmt -w file.v` to fix these automatically')
|
||||||
}
|
}
|
||||||
if errors.len > 0 {
|
if errors.len > 0 || (is_werror && warnings.len > 0) {
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,4 +49,4 @@ Use "v help <command>" for more information about a command, example: `v help bu
|
||||||
Use "v help other" to see less frequently used commands.
|
Use "v help other" to see less frequently used commands.
|
||||||
|
|
||||||
Note: Help is required to write more help topics.
|
Note: Help is required to write more help topics.
|
||||||
Only build, new, init, doc, fmt, run, test, search, install, remove, update, bin2v, check-md are properly documented currently.
|
Only build, new, init, doc, fmt, vet, run, test, search, install, remove, update, bin2v, check-md are properly documented currently.
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
Usage:
|
||||||
|
v vet [options] path_to_source.v [path_to_other_source.v]
|
||||||
|
v vet [options] path/to/dir [path/to/other_dir]
|
||||||
|
|
||||||
|
Reports suspicious code constructs.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-W Exit with code 1, even if vet only reported warnings. Useful for checks in CI.
|
||||||
|
-hide-warnings Do not print warnings to stderr.
|
||||||
|
-v, -verbose Enable verbose logging.
|
||||||
|
-force (NB: vet development only!) Do not skip the vet regression tests.
|
Loading…
Reference in New Issue