From 999a5a51a0c00bac636adab86fc0033d0bbd98e0 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 22 Mar 2025 03:08:05 -0600 Subject: make lint/unknown: Have unknown files be errors --- .editorconfig | 6 ++++++ GNUmakefile | 4 ++-- build-aux/lint-unknown | 16 +++++++++++++++- lib9p/tests/runtest | 6 +++--- lib9p/tests/test_server/CMakeLists.txt | 2 +- lib9p/tests/test_server/main.c | 2 +- lib9p/tests/test_server/static/Documentation/x | 7 ------- lib9p/tests/test_server/static/Documentation/x.txt | 7 +++++++ 8 files changed, 35 insertions(+), 15 deletions(-) delete mode 100644 lib9p/tests/test_server/static/Documentation/x create mode 100644 lib9p/tests/test_server/static/Documentation/x.txt diff --git a/.editorconfig b/.editorconfig index af47cbe..82b2335 100644 --- a/.editorconfig +++ b/.editorconfig @@ -46,6 +46,12 @@ _mode = python3 indent_style = space indent_size = 4 +[requirements.txt] +_mode = pip + +[**/Documentation/**.txt] +_mode = man-cat + [{.editorconfig,.gitmodules}] _mode = ini diff --git a/GNUmakefile b/GNUmakefile index bae7357..b777a9e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -121,7 +121,7 @@ lint/python3: lint/%: build-aux/venv ! grep -nh 'SPECIAL$$' -- lib9p/idl.gen lint/c: lint/%: build-aux/lint-h build-aux/get-dscname ./build-aux/lint-h $(filter %.h,$(sources_$*)) -lint/make lint/cmake lint/gitignore lint/ini lint/9p lint/markdown: lint/%: +lint/make lint/cmake lint/gitignore lint/ini lint/9p lint/markdown lint/pip lint/man-cat: lint/%: @: lint/unknown: lint/%: build-aux/lint-unknown ./build-aux/lint-unknown $(sources_$*) @@ -139,7 +139,7 @@ format/sh format/bash: format/% @: format/c: format/%: @: TODO: Adopt a C code-formatter -format/make format/cmake format/gitignore format/ini format/9p format/markdown: format/%: +format/make format/cmake format/gitignore format/ini format/9p format/markdown format/pip format/man-cat: format/%: @: format/unknown: format/%: @: diff --git a/build-aux/lint-unknown b/build-aux/lint-unknown index 3c2e91b..dda9541 100755 --- a/build-aux/lint-unknown +++ b/build-aux/lint-unknown @@ -7,4 +7,18 @@ RED=$(tput setaf 1) RESET=$(tput sgr0) -printf "${RED}%s${RESET}: cannot lint unknown file type\n" "$@" >&2 +err() { + printf "${RED}%s${RESET}: %s\n" "$1" "$2" >&2 + r=1 +} + +r=0 +for filename in "$@"; do + if ! { [ -f "$filename" ] && ! [ -h "$filename" ]; }; then + # Ignore non-files + continue + fi + + err "$filename" 'cannot lint unknown file type' +done +exit $r diff --git a/lib9p/tests/runtest b/lib9p/tests/runtest index 3a46f28..a745f12 100755 --- a/lib9p/tests/runtest +++ b/lib9p/tests/runtest @@ -32,7 +32,7 @@ expect_lines \ out=$("${client[@]}" ls -l 'Documentation/') expect_lines \ - '--r--r--r-- M 0 root root 162 Oct 7 15:51 x' + '--r--r--r-- M 0 root root 166 Oct 7 15:51 x' out=$("${client[@]}" read 'README.md') expect_lines \ @@ -47,7 +47,7 @@ expect_lines \ out=$("${client[@]}" read 'Documentation/x') expect_lines \ ' -foo diff --git a/lib9p/tests/test_server/static/Documentation/x.txt b/lib9p/tests/test_server/static/Documentation/x.txt new file mode 100644 index 0000000..e85ee4e --- /dev/null +++ b/lib9p/tests/test_server/static/Documentation/x.txt @@ -0,0 +1,7 @@ + +foo -- cgit v1.2.3-2-g168b