mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
Fix: vet false warning on brackets in documentation (#17767)
This commit is contained in:
parent
db97630117
commit
713c95fcc8
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
// normalize_vector Normalizes a vector
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// ```v
|
||||||
|
// vector := Vector{3, 4}
|
||||||
|
// normalize_vector(vector) // Vector{0.6, 0.8}
|
||||||
|
// ```
|
||||||
|
pub fn normalize_vector(vector f32) {}
|
@ -187,23 +187,28 @@ fn (mut vt Vet) vet_fn_documentation(lines []string, line string, lnumber int) {
|
|||||||
prev_prev_line = lines[j - 1]
|
prev_prev_line = lines[j - 1]
|
||||||
}
|
}
|
||||||
prev_line := lines[j]
|
prev_line := lines[j]
|
||||||
|
|
||||||
|
if prev_line.starts_with('//') {
|
||||||
|
if prev_line.starts_with('// ${fn_name} ') {
|
||||||
|
grab = false
|
||||||
|
break
|
||||||
|
} else if prev_line.starts_with('// ${fn_name}')
|
||||||
|
&& !prev_prev_line.starts_with('//') {
|
||||||
|
grab = false
|
||||||
|
clean_line := line.all_before_last('{').trim(' ')
|
||||||
|
vt.warn('The documentation for "${clean_line}" seems incomplete.',
|
||||||
|
lnumber, .doc)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if prev_line.contains('}') { // We've looked back to the above scope, stop here
|
if prev_line.contains('}') { // We've looked back to the above scope, stop here
|
||||||
break
|
break
|
||||||
} else if prev_line.starts_with('// ${fn_name} ') {
|
|
||||||
grab = false
|
|
||||||
break
|
|
||||||
} else if prev_line.starts_with('// ${fn_name}')
|
|
||||||
&& !prev_prev_line.starts_with('//') {
|
|
||||||
grab = false
|
|
||||||
clean_line := line.all_before_last('{').trim(' ')
|
|
||||||
vt.warn('The documentation for "${clean_line}" seems incomplete.',
|
|
||||||
lnumber, .doc)
|
|
||||||
break
|
|
||||||
} else if prev_line.starts_with('[') {
|
} else if prev_line.starts_with('[') {
|
||||||
tags << collect_tags(prev_line)
|
tags << collect_tags(prev_line)
|
||||||
continue
|
continue
|
||||||
} else if prev_line.starts_with('//') { // Single-line comment
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if grab {
|
if grab {
|
||||||
|
Loading…
Reference in New Issue
Block a user