File tree Expand file tree Collapse file tree
crates/prek/src/hooks/builtin_hooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,13 +4,18 @@ use crate::hook::Hook;
44
55pub ( super ) const ILLEGAL_WINDOWS_PATTERN : & str = r"(?i)((^|/)(CON|PRN|AUX|NUL|COM[\d\x{00B9}\x{00B2}\x{00B3}]|LPT[\d\x{00B9}\x{00B2}\x{00B3}])(\.|/|$)|[<>:\x22\\|?*\x00-\x1F]|/[^/]*[\.\s]/|[^/]*[\.\s]$)" ;
66
7+ // Keep this hook in `builtin_hooks` instead of `pre_commit_hooks`.
8+ //
9+ // Upstream implements `check-illegal-windows-names` as a `fail` hook with a
10+ // `files` regex. Our pre-commit-hooks fast path already handles that generic
11+ // `fail` language in Rust, so there is no dedicated fast-path implementation to
12+ // add here. This module only exists to provide the builtin-hook equivalent:
13+ // reuse the same regex for matching, then emit a simple fail-style message.
714pub ( crate ) fn check_illegal_windows_names ( _hook : & Hook , filenames : & [ & Path ] ) -> ( i32 , Vec < u8 > ) {
815 if filenames. is_empty ( ) {
916 return ( 0 , Vec :: new ( ) ) ;
1017 }
1118
12- // Matching is handled by the hook's `files` pattern. Any filename that reaches this
13- // builtin is already known to be invalid, so we only need to emit fail-style errors.
1419 let mut output = Vec :: new ( ) ;
1520 for filename in filenames {
1621 output. extend_from_slice (
You can’t perform that action at this time.
0 commit comments