ci: fix web rules failure (#3003)

* ci: fix web rules failure

* address feedback

* ruff cleanup
This commit is contained in:
Mike Hunhoff
2026-04-07 13:01:23 -06:00
committed by GitHub
parent ed7e0cd77d
commit c55b06860c
3 changed files with 11 additions and 7 deletions

7
.github/ruff.toml vendored
View File

@@ -1,6 +1,6 @@
line-length = 120
preview = true # Required to enable pre-release copyright header checks (CPY001)
explicit-preview-rules = true
lint.explicit-preview-rules = true
exclude = [
# Exclude a variety of commonly ignored directories.
@@ -28,7 +28,7 @@ exclude = [
# protobuf generated files
"*_pb2.py",
"*_pb2.pyi",
"rules"
"../rules"
]
lint.select = [
@@ -40,12 +40,11 @@ lint.select = [
"ISC", # flake8-implicit-str-concat (detect accidental multi-line string issues)
"T20", # flake8-print (prevent leftover print/pprint statements)
"SIM", # flake8-simplify (code simplification upgrades)
"CPY", # flake8-copyright (header requirement enforcement)
"CPY001", # flake8-copyright (header requirement enforcement)
"G", # flake8-logging-format (logging statement validation)
"TD", # flake8-todos (TODO formatting requirements)
"PTH", # flake8-use-pathlib (migration from os.path to Pathlib)
"UP", # pyupgrade (modern Python syntax upgrades)
"CPY001", # flake8-copyright
]
# Allow autofix for all enabled rules (when `--fix`) is provided.

View File

@@ -127,7 +127,11 @@ def render_rule(timestamps, path: Path) -> str:
return html_content
yaml_files = [str(p) for p in input_directory.glob("**/*.yml")]
yaml_files = [
str(p)
for p in input_directory.glob("**/*.yml")
if not any(part.startswith(".") for part in p.relative_to(input_directory).parts)
]
timestamps = {}
for line in txt_file_path.read_text(encoding="utf-8").splitlines():

View File

@@ -29,9 +29,10 @@ assert start_dir.exists(), "start directory must exist"
def get_yml_files_and_dates(start_dir: Path):
yml_files = []
for root, _, files in os.walk(start_dir):
for root, dirs, files in os.walk(start_dir):
dirs[:] = [d for d in dirs if not d.startswith(".")]
for file in files:
if file.endswith(".yml") or file.endswith(".yaml"):
if file.endswith(".yml"):
file_path = Path(root) / file
proc = subprocess.run(