| 293 | |
| 294 | class WarnMutableRev(cfgv.Conditional): |
| 295 | def check(self, dct: dict[str, Any]) -> None: |
| 296 | super().check(dct) |
| 297 | |
| 298 | if self.key in dct: |
| 299 | rev = dct[self.key] |
| 300 | |
| 301 | if '.' not in rev and not re.match(r'^[a-fA-F0-9]+$', rev): |
| 302 | logger.warning( |
| 303 | f'The {self.key!r} field of repo {dct["repo"]!r} ' |
| 304 | f'appears to be a mutable reference ' |
| 305 | f'(moving tag / branch). Mutable references are never ' |
| 306 | f'updated after first install and are not supported. ' |
| 307 | f'See https://pre-commit.com/#using-the-latest-version-for-a-repository ' # noqa: E501 |
| 308 | f'for more details. ' |
| 309 | f'Hint: `pre-commit autoupdate` often fixes this.', |
| 310 | ) |
| 311 | |
| 312 | |
| 313 | class OptionalSensibleRegexAtHook(cfgv.OptionalNoDefault): |