diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c0a73d33a..8ef7651b40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -249,3 +249,12 @@ jobs: #node hi.js - name: Test v binaries run: ./v -silent build-vbinaries + + docs-line-len-check: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v1 + - name: Build + run: make + - name: Check docs line length + run: ./v run cmd/tools/check-md.v doc/docs.md CHANGELOG.md diff --git a/.gitignore b/.gitignore index 434cbfb9f7..9748cb1694 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ fns.txt /v.c /v.*.c /v.c.out +/cmd/tools/check-md /cmd/tools/performance_compare /cmd/tools/oldv /cmd/tools/vrepl diff --git a/cmd/tools/check-md.v b/cmd/tools/check-md.v new file mode 100644 index 0000000000..2cb2bb7e36 --- /dev/null +++ b/cmd/tools/check-md.v @@ -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) + } + */ + +}