mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ci: separate workflow for docs line len check (#6653)
This commit is contained in:
@ -8,23 +8,36 @@ const (
|
||||
|
||||
fn main() {
|
||||
files_paths := os.args[1..]
|
||||
mut warnings := 0
|
||||
mut errors := 0
|
||||
for file_path in files_paths {
|
||||
real_path := os.real_path(file_path)
|
||||
lines := os.read_lines(real_path) or {
|
||||
println('"$file_path" does not exist')
|
||||
warnings++
|
||||
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++
|
||||
linetrace_msg := '$file_path:${i + 1}:${line.len + 1}: '
|
||||
if line.starts_with('|') {
|
||||
println(linetrace_msg + 'long table (warn)')
|
||||
warnings++
|
||||
} else if line.contains('https') {
|
||||
println(linetrace_msg + 'long link (warn)')
|
||||
warnings++
|
||||
} else {
|
||||
eprintln(linetrace_msg + 'line too long')
|
||||
errors++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: uncomment this AFTER doc/docs.md line lengths are fixed
|
||||
/*
|
||||
if warnings > 0 || errors > 0 {
|
||||
println('\nWarnings | Errors')
|
||||
println('$warnings\t | $errors')
|
||||
}
|
||||
if errors > 0 {
|
||||
exit(1)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
Reference in New Issue
Block a user