| 312 | |
| 313 | class OptionalSensibleRegexAtHook(cfgv.OptionalNoDefault): |
| 314 | def check(self, dct: dict[str, Any]) -> None: |
| 315 | super().check(dct) |
| 316 | |
| 317 | if '/*' in dct.get(self.key, ''): |
| 318 | logger.warning( |
| 319 | f'The {self.key!r} field in hook {dct.get("id")!r} is a ' |
| 320 | f"regex, not a glob -- matching '/*' probably isn't what you " |
| 321 | f'want here', |
| 322 | ) |
| 323 | for fwd_slash_re in (r'[\\/]', r'[\/]', r'[/\\]'): |
| 324 | if fwd_slash_re in dct.get(self.key, ''): |
| 325 | logger.warning( |
| 326 | fr'pre-commit normalizes slashes in the {self.key!r} ' |
| 327 | fr'field in hook {dct.get("id")!r} to forward slashes, ' |
| 328 | fr'so you can use / instead of {fwd_slash_re}', |
| 329 | ) |
| 330 | |
| 331 | |
| 332 | class OptionalSensibleRegexAtTop(cfgv.OptionalNoDefault): |