@@ -144,18 +144,13 @@ def check(self, dct: Dict[str, Any]) -> None:
144144 f"regex, not a glob -- matching '/*' probably isn't what you "
145145 f'want here' ,
146146 )
147- if r'[\/]' in dct .get (self .key , '' ):
148- logger .warning (
149- fr'pre-commit normalizes slashes in the { self .key !r} field '
150- fr'in hook { dct .get ("id" )!r} to forward slashes, so you '
151- fr'can use / instead of [\/]' ,
152- )
153- if r'[/\\]' in dct .get (self .key , '' ):
154- logger .warning (
155- fr'pre-commit normalizes slashes in the { self .key !r} field '
156- fr'in hook { dct .get ("id" )!r} to forward slashes, so you '
157- fr'can use / instead of [/\\]' ,
158- )
147+ for fwd_slash_re in [r'[\\/]' , r'[\/]' , r'[/\\]' ]:
148+ if fwd_slash_re in dct .get (self .key , '' ):
149+ logger .warning (
150+ fr'pre-commit normalizes slashes in the { self .key !r} '
151+ fr'field in hook { dct .get ("id" )!r} to forward slashes, '
152+ fr'so you can use / instead of { fwd_slash_re } ' ,
153+ )
159154
160155
161156class OptionalSensibleRegexAtTop (cfgv .OptionalNoDefault ):
@@ -167,18 +162,13 @@ def check(self, dct: Dict[str, Any]) -> None:
167162 f'The top-level { self .key !r} field is a regex, not a glob -- '
168163 f"matching '/*' probably isn't what you want here" ,
169164 )
170- if r'[\/]' in dct .get (self .key , '' ):
171- logger .warning (
172- fr'pre-commit normalizes the slashes in the top-level '
173- fr'{ self .key !r} field to forward slashes, so you can use / '
174- fr'instead of [\/]' ,
175- )
176- if r'[/\\]' in dct .get (self .key , '' ):
177- logger .warning (
178- fr'pre-commit normalizes the slashes in the top-level '
179- fr'{ self .key !r} field to forward slashes, so you can use / '
180- fr'instead of [/\\]' ,
181- )
165+ for fwd_slash_re in [r'[\\/]' , r'[\/]' , r'[/\\]' ]:
166+ if fwd_slash_re in dct .get (self .key , '' ):
167+ logger .warning (
168+ fr'pre-commit normalizes the slashes in the top-level '
169+ fr'{ self .key !r} field to forward slashes, so you '
170+ fr'can use / instead of { fwd_slash_re } ' ,
171+ )
182172
183173
184174class MigrateShaToRev :
0 commit comments