summaryrefslogtreecommitdiffstats
path: root/scripts/check_client_is_uptodate.py
blob: 1c5b1be282d5c8463380ab9f0c5f099b18ae5392 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import sys
import subprocess

AUTOGENERATED_CLIENT_FILE = "pygls/lsp/client.py"

subprocess.run(["poe", "generate_client"])

result = subprocess.run(
    ["git", "diff", "--exit-code", AUTOGENERATED_CLIENT_FILE], stdout=subprocess.DEVNULL
)

if result.returncode == 0:
    print("✅ Pygls client is up to date")
else:
    print(
        "🔴 Pygls client not uptodate\n"
        "1. Generate with: `poetry run poe generate_client`\n"
        "2. Commit"
    )
    sys.exit(result.returncode)