| 331 | |
| 332 | class OptionalSensibleRegexAtTop(cfgv.OptionalNoDefault): |
| 333 | def check(self, dct: dict[str, Any]) -> None: |
| 334 | super().check(dct) |
| 335 | |
| 336 | if '/*' in dct.get(self.key, ''): |
| 337 | logger.warning( |
| 338 | f'The top-level {self.key!r} field is a regex, not a glob -- ' |
| 339 | f"matching '/*' probably isn't what you want here", |
| 340 | ) |
| 341 | for fwd_slash_re in (r'[\\/]', r'[\/]', r'[/\\]'): |
| 342 | if fwd_slash_re in dct.get(self.key, ''): |
| 343 | logger.warning( |
| 344 | fr'pre-commit normalizes the slashes in the top-level ' |
| 345 | fr'{self.key!r} field to forward slashes, so you ' |
| 346 | fr'can use / instead of {fwd_slash_re}', |
| 347 | ) |
| 348 | |
| 349 | |
| 350 | def _entry(modname: str) -> str: |