summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-03-22 03:08:05 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-03-22 16:22:29 -0600
commit999a5a51a0c00bac636adab86fc0033d0bbd98e0 (patch)
tree503051a51dad1a3059ecf002794177ea2f0cb017
parent8d3991d6cca1a57ef5c48460313a07f709c89248 (diff)
make lint/unknown: Have unknown files be errors
-rw-r--r--.editorconfig6
-rw-r--r--GNUmakefile4
-rwxr-xr-xbuild-aux/lint-unknown16
-rwxr-xr-xlib9p/tests/runtest6
-rw-r--r--lib9p/tests/test_server/CMakeLists.txt2
-rw-r--r--lib9p/tests/test_server/main.c2
-rw-r--r--lib9p/tests/test_server/static/Documentation/x.txt (renamed from lib9p/tests/test_server/static/Documentation/x)2
7 files changed, 29 insertions, 9 deletions
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 \
'<!--' \
- ' Documentation/x - test static file' \
+ ' Documentation/x.txt - test static file' \
'' \
' Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>' \
' SPDX-License-Identifier: AGPL-3.0-or-later' \
@@ -56,7 +56,7 @@ expect_lines \
out=$("${client[@]}" stat 'Documentation/x')
expect_lines \
- "'x' 'root' 'root' 'root' q (0000000000000001 1 ) m 0444 at 1728337905 mt 1728337904 l 162 t 0 d 0"
+ "'x' 'root' 'root' 'root' q (0000000000000001 1 ) m 0444 at 1728337905 mt 1728337904 l 166 t 0 d 0"
out=$("${client[@]}" write 'shutdown' <<<1)
expect_lines ''
diff --git a/lib9p/tests/test_server/CMakeLists.txt b/lib9p/tests/test_server/CMakeLists.txt
index a107b75..bbedad3 100644
--- a/lib9p/tests/test_server/CMakeLists.txt
+++ b/lib9p/tests/test_server/CMakeLists.txt
@@ -36,7 +36,7 @@ target_sources(test_server PRIVATE
target_embed_sources(test_server_objs test_server static.h
static/README.md
- static/Documentation/x
+ static/Documentation/x.txt
)
endif()
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c
index 59a21ec..074dbe7 100644
--- a/lib9p/tests/test_server/main.c
+++ b/lib9p/tests/test_server/main.c
@@ -132,7 +132,7 @@ enum { PATH_BASE = __COUNTER__ };
struct lib9p_srv_file root =
STATIC_DIR("",
STATIC_DIR("Documentation",
- STATIC_FILE("x", Documentation_x),
+ STATIC_FILE("x", Documentation_x_txt),
),
STATIC_FILE("README.md", README_md),
lo_box_api_as_lib9p_srv_file(&(struct api_file){.pathnum = PATH_COUNTER}),
diff --git a/lib9p/tests/test_server/static/Documentation/x b/lib9p/tests/test_server/static/Documentation/x.txt
index b9b08d4..e85ee4e 100644
--- a/lib9p/tests/test_server/static/Documentation/x
+++ b/lib9p/tests/test_server/static/Documentation/x.txt
@@ -1,5 +1,5 @@
<!--
- Documentation/x - test static file
+ Documentation/x.txt - test static file
Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
SPDX-License-Identifier: AGPL-3.0-or-later