Fix ruff lint failures in scripts/checkstyle.py

This PR's new Ruff CI job surfaced pre-existing style issues (unsorted
imports, deprecated typing.List/Dict, nested ifs, bare exit()) in
checkstyle.py. Cleaned these up so the newly added lint job passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Vijay Misal 2026-08-12 16:23:22 +05:30 committed by vjymisal0
parent 9ccb605c18
commit 1dd3c2e1bd
No known key found for this signature in database
GPG key ID: 19904AA4CFDB27F9

View file

@ -3,7 +3,7 @@ import argparse
import os
import re
import sys
from collections.abc import Callable # Compatibility.
from collections.abc import Callable # compat
from pathlib import Path
from typing import Any
@ -102,12 +102,11 @@ def lintfile(file: Path, rules: list[Rule], options: dict[str, Any]):
for rule in rules:
should_run = False
# ruff: noqa: SIM102
if 'sh' in rule['fileTypes']:
if file.name.endswith('.sh'):
if 'sh' in rule['fileTypes'] and file.name.endswith('.sh'):
should_run = True
if 'bash' in rule['fileTypes']:
if file.name.endswith('.bash') or file.name.endswith('.bats') or file.name.startswith('git-'):
if 'bash' in rule['fileTypes'] and (
file.name.endswith('.bash') or file.name.endswith('.bats') or file.name.startswith('git-')
):
should_run = True
if options['verbose']: