mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools/vcheck-md: add -skip_line_length_check flag and fix vmod
handling in '```vmod' (#17997)
This commit is contained in:
parent
95d1beb008
commit
d48aa15514
@ -50,6 +50,7 @@ fn main() {
|
||||
println('´-all´ flag is deprecated. Please use ´v check-md .´ instead.')
|
||||
exit(1)
|
||||
}
|
||||
mut skip_line_length_check := '-skip-line-length-check' in os.args
|
||||
if show_progress {
|
||||
// this is intended to be replaced by the progress lines
|
||||
println('')
|
||||
@ -76,6 +77,7 @@ fn main() {
|
||||
continue
|
||||
}
|
||||
mut mdfile := MDFile{
|
||||
skip_line_length_check: skip_line_length_check
|
||||
path: file_path
|
||||
lines: lines
|
||||
}
|
||||
@ -157,6 +159,7 @@ enum MDFileParserState {
|
||||
|
||||
struct MDFile {
|
||||
path string
|
||||
skip_line_length_check bool
|
||||
mut:
|
||||
lines []string
|
||||
examples []VCodeExample
|
||||
@ -176,6 +179,7 @@ fn (mut f MDFile) check() CheckResult {
|
||||
mut anchor_data := AnchorData{}
|
||||
for j, line in f.lines {
|
||||
// f.progress('line: $j')
|
||||
if !f.skip_line_length_check {
|
||||
if f.state == .vexample {
|
||||
if line.len > too_long_line_length_example {
|
||||
wprintln(wline(f.path, j, line.len, 'example lines must be less than ${too_long_line_length_example} characters'))
|
||||
@ -205,6 +209,7 @@ fn (mut f MDFile) check() CheckResult {
|
||||
eprintln(line)
|
||||
res.errors++
|
||||
}
|
||||
}
|
||||
if f.state == .markdown {
|
||||
anchor_data.add_links(j, line)
|
||||
anchor_data.add_link_targets(j, line)
|
||||
@ -602,6 +607,8 @@ fn (mut f MDFile) check_examples() CheckResult {
|
||||
'play' {}
|
||||
// same as play, but run example as a test
|
||||
'play-test' {}
|
||||
// when ```vmod
|
||||
'mod' {}
|
||||
else {
|
||||
eprintln(eline(f.path, e.sline, 0, 'unrecognized command: "${command}", use one of: wip/ignore/compile/failcompile/okfmt/nofmt/oksyntax/badsyntax/cgen/globals/live/shared'))
|
||||
should_cleanup_vfile = false
|
||||
|
Loading…
Reference in New Issue
Block a user