def check_license_headers()

in scripts/lint.py [0:0]


def check_license_headers() -> None:
    print("Checking license headers")
    git = detect_git()
    head_commit_hash = git("rev-parse", "HEAD", _err=sys.stderr).strip()
    current_branch_name = git("rev-parse", "--abbrev-ref", "HEAD").strip()
    branch_name = f"automation/lint-{head_commit_hash}"
    try:
        # Prepare the branch
        git_branch_delete(branch_name)
        git(
            "checkout",
            "-b",
            branch_name,
            _in=sys.stdin,
            _out=sys.stdout,
            _err=sys.stderr,
        )

        # Apply headers licence
        uv = detect_uv()
        uv(
            "run",
            "poe",
            "project:license",
            _in=sys.stdin,
            _out=sys.stdout,
            _err=sys.stderr,
        )

        # Validate
        changes = git("status", "-s", _err=sys.stderr).strip()
        if changes:
            fatal(f"Apply headers license to:\n{changes}")
    finally:
        git("checkout", current_branch_name)
        git_branch_delete(branch_name)