Ensforce Python formatting in CI

This commit is contained in:
Kovid Goyal 2026-08-05 19:25:27 +05:30
parent f8829f44b7
commit bcf5ffe73f
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 0 deletions

View file

@ -348,6 +348,8 @@ def main() -> None:
q = '\n'.join(filter(lambda x: not x.rstrip().endswith('_generated.go'), q.strip().splitlines())).strip()
if q:
raise SystemExit(q)
if subprocess.run(['ruff', 'format', '--check']).returncode != 0:
raise SystemExit('Some Python files are not formatted correctly')
elif action == 'check-dependencies':
check_dependencies()
else:

View file

@ -1096,6 +1096,7 @@ def is_valid_slot(x: str) -> TypeGuard[Slot]:
VALID_VAR_TYPES: frozenset[str] = frozenset({'uint', 'int', 'float', 'double', 'bool'})
@run_once
def identifiers_pat() -> re.Pattern[str]:
return re.compile(r'^[A-Za-z_][A-Za-z0-9_]*$')