mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vet: add suggestions for function documentation (#7890)
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
cmd/tools/vvet/tests/array_init_one_val.vv:2: Use `var == value` instead of `var in [value]`
|
||||
cmd/tools/vvet/tests/array_init_one_val.vv:2: error: Use `var == value` instead of `var in [value]`
|
||||
NB: You can run `v fmt -w file.v` to fix these automatically
|
||||
|
@ -1,2 +1,2 @@
|
||||
cmd/tools/vvet/tests/indent_with_space.vv:2: Looks like you are using spaces for indentation.
|
||||
cmd/tools/vvet/tests/indent_with_space.vv:2: error: Looks like you are using spaces for indentation.
|
||||
NB: You can run `v fmt -w file.v` to fix these automatically
|
||||
|
4
cmd/tools/vvet/tests/module_file_test.out
Normal file
4
cmd/tools/vvet/tests/module_file_test.out
Normal file
@ -0,0 +1,4 @@
|
||||
cmd/tools/vvet/tests/module_file_test.vv:7: warning: Function documentation seems to be missing for "pub fn foo() string".
|
||||
cmd/tools/vvet/tests/module_file_test.vv:13: warning: A function name is missing from the documentation of "pub fn bar() string".
|
||||
cmd/tools/vvet/tests/module_file_test.vv:35: warning: Function documentation seems to be missing for "pub fn (f Foo) foo() string".
|
||||
cmd/tools/vvet/tests/module_file_test.vv:46: warning: A function name is missing from the documentation of "pub fn (f Foo) fooo() string".
|
49
cmd/tools/vvet/tests/module_file_test.vv
Normal file
49
cmd/tools/vvet/tests/module_file_test.vv
Normal file
@ -0,0 +1,49 @@
|
||||
module foo
|
||||
|
||||
struct Foo {
|
||||
foo int
|
||||
}
|
||||
|
||||
pub fn foo() string {
|
||||
// Missing doc
|
||||
return 'foo'
|
||||
}
|
||||
|
||||
// foo does bar
|
||||
pub fn bar() string {
|
||||
// not using convention style: '// <fn name>'
|
||||
return 'bar'
|
||||
}
|
||||
|
||||
// fooo does x
|
||||
pub fn fooo() string {
|
||||
// Documented
|
||||
return 'fooo'
|
||||
}
|
||||
|
||||
// booo does x
|
||||
fn booo() string {
|
||||
// Documented, but not pub
|
||||
return 'booo'
|
||||
}
|
||||
|
||||
fn boo() string {
|
||||
// Missing doc
|
||||
return 'boo'
|
||||
}
|
||||
|
||||
pub fn (f Foo) foo() string {
|
||||
// Missing doc
|
||||
return f.fo()
|
||||
}
|
||||
|
||||
fn (f Foo) fo() string {
|
||||
// Missing doc, but not pub
|
||||
return 'foo'
|
||||
}
|
||||
|
||||
// wrong doc
|
||||
pub fn (f Foo) fooo() string {
|
||||
// not using convention
|
||||
return f.fo()
|
||||
}
|
@ -1,2 +1,2 @@
|
||||
cmd/tools/vvet/tests/parens_space_a.vv:1: Looks like you are adding a space after `(`
|
||||
cmd/tools/vvet/tests/parens_space_a.vv:1: error: Looks like you are adding a space after `(`
|
||||
NB: You can run `v fmt -w file.v` to fix these automatically
|
||||
|
@ -1,2 +1,2 @@
|
||||
cmd/tools/vvet/tests/parens_space_b.vv:1: Looks like you are adding a space before `)`
|
||||
cmd/tools/vvet/tests/parens_space_b.vv:1: error: Looks like you are adding a space before `)`
|
||||
NB: You can run `v fmt -w file.v` to fix these automatically
|
||||
|
Reference in New Issue
Block a user