1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tools: better error messages for v check-md (#13149)

This commit is contained in:
jeffmikels 2022-01-12 18:15:43 -05:00 committed by GitHub
parent 547169674d
commit 7882915409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -172,30 +172,30 @@ fn (mut f MDFile) check() CheckResult {
// f.progress('line: $j') // f.progress('line: $j')
if f.state == .vexample { if f.state == .vexample {
if line.len > too_long_line_length_example { if line.len > too_long_line_length_example {
wprintln(wline(f.path, j, line.len, 'long V example line')) wprintln(wline(f.path, j, line.len, 'example lines must be less than $too_long_line_length_example characters'))
wprintln(line) wprintln(line)
res.warnings++ res.warnings++
} }
} else if f.state == .codeblock { } else if f.state == .codeblock {
if line.len > too_long_line_length_codeblock { if line.len > too_long_line_length_codeblock {
wprintln(wline(f.path, j, line.len, 'long code block line')) wprintln(wline(f.path, j, line.len, 'code lines must be less than $too_long_line_length_codeblock characters'))
wprintln(line) wprintln(line)
res.warnings++ res.warnings++
} }
} else if line.starts_with('|') { } else if line.starts_with('|') {
if line.len > too_long_line_length_table { if line.len > too_long_line_length_table {
wprintln(wline(f.path, j, line.len, 'long table')) wprintln(wline(f.path, j, line.len, 'table lines must be less than $too_long_line_length_table characters'))
wprintln(line) wprintln(line)
res.warnings++ res.warnings++
} }
} else if line.contains('http') { } else if line.contains('http') {
if line.all_after('https').len > too_long_line_length_link { if line.all_after('https').len > too_long_line_length_link {
wprintln(wline(f.path, j, line.len, 'long link')) wprintln(wline(f.path, j, line.len, 'link lines must be less than $too_long_line_length_link characters'))
wprintln(line) wprintln(line)
res.warnings++ res.warnings++
} }
} else if line.len > too_long_line_length_other { } else if line.len > too_long_line_length_other {
eprintln(eline(f.path, j, line.len, 'line too long')) eprintln(eline(f.path, j, line.len, 'must be less than $too_long_line_length_other characters'))
eprintln(line) eprintln(line)
res.errors++ res.errors++
} }