From 714f1e57b18e12cfccab2a34697c42c895f58886 Mon Sep 17 00:00:00 2001 From: Eric L Frederich Date: Tue, 16 Apr 2024 14:43:15 -0400 Subject: [PATCH] support more illegal Windows filenames See comments in #1031 --- .pre-commit-hooks.yaml | 2 +- tests/check_illegal_windows_names_test.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 116392d..44a8648 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -44,7 +44,7 @@ name: check illegal windows names entry: Illegal windows filenames detected language: fail - files: '(?i)(^|/)(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|/|$)' + files: '(?i)((^|/)(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|/|$)|:)' - id: check-json name: check json description: checks json files for parseable syntax. diff --git a/tests/check_illegal_windows_names_test.py b/tests/check_illegal_windows_names_test.py index 4dce4f6..35a5be3 100644 --- a/tests/check_illegal_windows_names_test.py +++ b/tests/check_illegal_windows_names_test.py @@ -28,6 +28,8 @@ def hook_re(): pytest.param('aux', id='without ext'), pytest.param('AuX.tXt', id='capitals'), pytest.param('com7.dat', id='com with digit'), + pytest.param(':', id='bare colon'), + pytest.param('file:Zone.Identifier', id='mid colon'), ), ) def test_check_illegal_windows_names_matches(hook_re, s):