mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ci: add a simple line length tool to check docs.md
This commit is contained in:

committed by
GitHub

parent
6f7c103e50
commit
20d900a21d
31
cmd/tools/check-md.v
Normal file
31
cmd/tools/check-md.v
Normal file
@ -0,0 +1,31 @@
|
||||
module main
|
||||
|
||||
import os
|
||||
|
||||
const (
|
||||
too_long_line_length = 100
|
||||
)
|
||||
|
||||
fn main() {
|
||||
files_paths := os.args[1..]
|
||||
mut errors := 0
|
||||
for file_path in files_paths {
|
||||
real_path := os.realpath(file_path)
|
||||
lines := os.read_lines(real_path) or {
|
||||
continue
|
||||
}
|
||||
for i, line in lines {
|
||||
if line.len > too_long_line_length {
|
||||
eprintln('$real_path:${i+1}:${line.len+1}: line too long')
|
||||
errors++
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: uncomment this AFTER doc/docs.md line lengths are fixed
|
||||
/*
|
||||
if errors > 0 {
|
||||
exit(1)
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
Reference in New Issue
Block a user