Skip to content

Commit 38148cd

Browse files
chore(sdk): fix ruff lint errors in pre_publish_check.py
Resolves 10 lint findings: - S603 subprocess call (bare noqa) - RUF015 list-index slice -> next() - RUF059 unused unpacked code -> _code - RUF005 x7 results + [False] -> [*results, False] Signed-off-by: Deborah Jacob <deborah@botanu.ai>
1 parent 8b2942d commit 38148cd

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

scripts/pre_publish_check.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def run(
9797
capture: bool = True,
9898
) -> Tuple[int, str, str]:
9999
"""Run a command and return (returncode, stdout, stderr)."""
100-
result = subprocess.run(
100+
result = subprocess.run( # noqa: S603
101101
cmd,
102102
cwd=str(cwd) if cwd else None,
103103
env=env,
@@ -249,7 +249,7 @@ def check_api_surface(venv: Path) -> bool:
249249
print(DIM + (err or out)[-1500:] + RESET)
250250
return False
251251
if "MISSING:" in out and "ALL OK" not in out:
252-
missing_line = [line for line in out.split("\n") if "MISSING:" in line][0]
252+
missing_line = next(line for line in out.split("\n") if "MISSING:" in line)
253253
fail(missing_line)
254254
return False
255255
exports = [line for line in out.split("\n") if line.startswith("EXPORTS:")]
@@ -346,7 +346,7 @@ def check_smoke_test(venv: Path) -> bool:
346346
"OTEL_LOGS_EXPORTER": "console",
347347
"OTEL_METRICS_EXPORTER": "none",
348348
}
349-
code, out, err = run([str(py), "-c", SMOKE_TEST_SCRIPT], env=env)
349+
_code, out, err = run([str(py), "-c", SMOKE_TEST_SCRIPT], env=env)
350350
if "SMOKE_OK" in out:
351351
ok("decorator + outcome + validation all pass")
352352
return True
@@ -383,37 +383,37 @@ def main() -> int:
383383

384384
step(3, total, "python -m build")
385385
if not check_build():
386-
return summarize(results + [False])
386+
return summarize([*results, False])
387387
results.append(True)
388388

389389
step(4, total, "twine check")
390390
if not check_twine():
391-
return summarize(results + [False])
391+
return summarize([*results, False])
392392
results.append(True)
393393

394394
step(5, total, "create clean venv + install wheel")
395395
try:
396396
venv_dir = make_venv()
397397
except RuntimeError as e:
398398
fail(str(e))
399-
return summarize(results + [False])
399+
return summarize([*results, False])
400400
if not check_install(venv_dir):
401-
return summarize(results + [False])
401+
return summarize([*results, False])
402402
results.append(True)
403403

404404
step(6, total, "version string")
405405
if not check_version(venv_dir):
406-
return summarize(results + [False])
406+
return summarize([*results, False])
407407
results.append(True)
408408

409409
step(7, total, "public API surface (__all__)")
410410
if not check_api_surface(venv_dir):
411-
return summarize(results + [False])
411+
return summarize([*results, False])
412412
results.append(True)
413413

414414
step(8, total, "end-to-end smoke test")
415415
if not check_smoke_test(venv_dir):
416-
return summarize(results + [False])
416+
return summarize([*results, False])
417417
results.append(True)
418418

419419
finally:

0 commit comments

Comments
 (0)