fix: resolve ruff lint errors (E402, F401, F821)
CI/CD / lint-test (push) Failing after 50s
CI/CD / build-push (push) Has been skipped

- check_versions.py: restore correct file (import re was placed before
  shebang causing E402 for all following imports; missing 'client' in
  kubernetes import causing F821 at line 236)
- request_upgrades.py: remove unused 're' import and unused 'client'
  from kubernetes import (only 'config' is needed here)
- web.py: remove unused 'os' import
This commit is contained in:
claude-code
2026-07-12 16:19:53 +00:00
parent 5ac7b2f5c5
commit ce470431c6
3 changed files with 7 additions and 5 deletions
+4 -2
View File
@@ -1,4 +1,3 @@
import re
#!/usr/bin/env python3
"""
k8s-version-tracker: Weekly Kubernetes image version checker and Mattermost notifier.
@@ -9,6 +8,8 @@ notification with the weekly report.
"""
import os
import re
import json
import logging
import subprocess
from dataclasses import dataclass, field
@@ -16,7 +17,7 @@ from typing import Optional
from datetime import datetime, timezone
import requests
from kubernetes import config
from kubernetes import client, config
from packaging.version import Version, InvalidVersion
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
@@ -120,6 +121,7 @@ def parse_image_ref(image: str) -> ImageInfo:
def _semver_tags(tags: list[str], current_tag: str) -> Optional[str]:
"""From a list of tags, return the latest stable semver tag comparable to current."""
norm = current_tag.lstrip("v")
has_v_prefix = current_tag.startswith("v")
# Detect suffix pattern (e.g. '-alpine', '-amd64')
suffix_match = re.search(r"(-[a-zA-Z][a-zA-Z0-9._-]*)$", norm)