-
Notifications
You must be signed in to change notification settings - Fork 0
chore: enforce python docstring coverage #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9169f43
6435b74
fd6f733
206955b
2115e39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,5 @@ | ||||||||||
| """Verify that design-plan documents include a complete Security Notes section.""" | ||||||||||
|
|
||||||||||
| from pathlib import Path | ||||||||||
| import sys | ||||||||||
|
|
||||||||||
|
|
@@ -15,6 +17,7 @@ | |||||||||
|
|
||||||||||
|
|
||||||||||
| def security_notes_section(content: str) -> str: | ||||||||||
| """Extract the lowercased Security Notes section from a plan document.""" | ||||||||||
| lowered = content.lower() | ||||||||||
| marker = SECURITY_NOTES_TEXT.lower() | ||||||||||
| start = lowered.find(marker) | ||||||||||
|
|
@@ -34,6 +37,7 @@ def security_notes_section(content: str) -> str: | |||||||||
|
|
||||||||||
|
|
||||||||||
| def main() -> int: | ||||||||||
| """Return a failing exit code when plan files are missing security notes.""" | ||||||||||
|
Comment on lines
39
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐งน Nitpick | ๐ต Trivial
์ด ํจ์๋ Security Notes ์น์ ์์ฒด๊ฐ ์์ ๋๋ง ์๋๋ผ, Line 48-50์ฒ๋ผ ํ์ ํ์ ์น์ ์ด ๋น ์ ธ๋ ์คํจ๋ฅผ ๋ฐํํฉ๋๋ค. ํ์ฌ ๋ฌธ๊ตฌ๋ฉด ์ฒดํฌ ๋ฒ์๋ฅผ ์คํดํ๊ธฐ ์ฌ์ฐ๋ ์ค๋ช ์ ๋ํ ๋๋ ํธ์ด ์ข๊ฒ ์ต๋๋ค. ์์ ์์ ์ def main() -> int:
- """Return a failing exit code when plan files are missing security notes."""
+ """Return a failing exit code when plan files are missing Security Notes or required subsections."""๐ Committable suggestion
Suggested change
๐ค Prompt for AI Agents |
||||||||||
| missing: list[str] = [] | ||||||||||
| for path in sorted(PLAN_DIR.glob("*.md")): | ||||||||||
| content = path.read_text(encoding="utf-8") | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| """Package desktop build outputs into traceable release artifacts.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from pathlib import Path | ||
|
|
@@ -8,6 +10,7 @@ | |
|
|
||
|
|
||
| def sha256_file(path: Path) -> str: | ||
| """Return the SHA-256 digest for a file.""" | ||
| digest = hashlib.sha256() | ||
| with path.open("rb") as handle: | ||
| for chunk in iter(lambda: handle.read(1024 * 1024), b""): | ||
|
|
@@ -16,9 +19,16 @@ def sha256_file(path: Path) -> str: | |
|
|
||
|
|
||
| def normalized_platform() -> str: | ||
| """Return the normalized artifact platform label for the current environment.""" | ||
| if artifact_platform := os.environ.get("BANDSCOPE_ARTIFACT_OS"): | ||
| return artifact_platform | ||
|
|
||
| target_triple = os.environ.get("BANDSCOPE_TARGET_TRIPLE", "") | ||
| if "windows" in target_triple: | ||
| return "windows" | ||
| if "apple-darwin" in target_triple: | ||
| return "macos" | ||
|
|
||
| system = platform.system().lower() | ||
| if system == "darwin": | ||
| return "macos" | ||
|
|
@@ -27,9 +37,16 @@ def normalized_platform() -> str: | |
|
|
||
|
|
||
| def normalized_architecture() -> str: | ||
| """Return the normalized artifact architecture label for the current environment.""" | ||
| if artifact_arch := os.environ.get("BANDSCOPE_ARTIFACT_ARCH"): | ||
| return artifact_arch | ||
|
|
||
| target_triple = os.environ.get("BANDSCOPE_TARGET_TRIPLE", "") | ||
| if target_triple.startswith(("x86_64", "amd64")): | ||
| return "amd64" | ||
| if target_triple.startswith(("aarch64", "arm64")): | ||
| return "arm64" | ||
|
|
||
| machine = platform.machine().lower() | ||
| if machine in {"x86_64", "amd64"}: | ||
| return "amd64" | ||
|
|
@@ -40,6 +57,7 @@ def normalized_architecture() -> str: | |
|
|
||
|
|
||
| def artifact_identity() -> dict[str, str]: | ||
| """Build the archive and manifest names for the current artifact target.""" | ||
| git_sha = os.environ.get("GITHUB_SHA", "local")[:12] | ||
| target_platform = normalized_platform() | ||
| target_arch = normalized_architecture() | ||
|
|
@@ -53,17 +71,25 @@ def artifact_identity() -> dict[str, str]: | |
|
|
||
|
|
||
| def expected_binary_path(repo_root: Path) -> Path: | ||
| system = normalized_platform() | ||
| """Return the expected desktop binary path for the selected target triple.""" | ||
| target_triple = os.environ.get("BANDSCOPE_TARGET_TRIPLE") | ||
| if target_triple and "windows" in target_triple: | ||
| system = "windows" | ||
| elif target_triple and "apple-darwin" in target_triple: | ||
| system = "macos" | ||
| else: | ||
| system = normalized_platform() | ||
| binary_name = ( | ||
| "bandscope-desktop.exe" if system == "windows" else "bandscope-desktop" | ||
| ) | ||
| target_root = repo_root / "apps" / "desktop" / "src-tauri" / "target" | ||
| if target_triple := os.environ.get("BANDSCOPE_TARGET_TRIPLE"): | ||
| if target_triple: | ||
| target_root = target_root / target_triple | ||
| return target_root / "release" / binary_name | ||
|
Comment on lines
73
to
88
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐งฉ Analysis chain๐ Script executed: #!/bin/bash
# Verify whether package_desktop_artifact.py is ever invoked with
# BANDSCOPE_TARGET_TRIPLE but without BANDSCOPE_ARTIFACT_OS / BANDSCOPE_ARTIFACT_ARCH.
rg -n -C3 'package_desktop_artifact\.py|BANDSCOPE_TARGET_TRIPLE|BANDSCOPE_ARTIFACT_OS|BANDSCOPE_ARTIFACT_ARCH'Repository: seonghobae/bandscope Length of output: 9738 ๐ Script executed: #!/bin/bash
# Read the test that checks Windows target on non-Windows host (lines 56-76)
sed -n '56,76p' services/analysis-engine/tests/test_release_packaging.pyRepository: seonghobae/bandscope Length of output: 784 ๐ Script executed: #!/bin/bash
# Read the full main() function to see how binary path and artifact identity are used together
sed -n '107,150p' scripts/release/package_desktop_artifact.pyRepository: seonghobae/bandscope Length of output: 1415 ๐ Script executed: #!/bin/bash
# Check if there's any validation logic around BANDSCOPE_TARGET_TRIPLE and artifact overrides
grep -n "raise\|ValueError\|AssertionError\|if.*BANDSCOPE_TARGET_TRIPLE" scripts/release/package_desktop_artifact.pyRepository: seonghobae/bandscope Length of output: 346 ํ๊น ํธ๋ฆฌํ๊ณผ ์ํฐํฉํธ ์๋ณ์๊ฐ ๋ถ๋ฆฌ๋ ์ํ์์ ๊ต์ฐจ ๋น๋ ์ ์์นด์ด๋ธ ์ด๋ฆ ๋ถ์ผ์น ์ํ
๐ค Prompt for AI Agents |
||
|
|
||
|
|
||
| def main() -> int: | ||
| """Package the desktop binary, frontend assets, and metadata into a zip archive.""" | ||
| repo_root = Path(__file__).resolve().parents[2] | ||
| binary_path = expected_binary_path(repo_root) | ||
| frontend_dist = repo_root / "apps" / "desktop" / "dist" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tracked๋ผ๋ ํํ์ด ํ์ฌ ๋์๊ณผ ๋ง์ง ์์ต๋๋ค.์ด ์คํฌ๋ฆฝํธ๋ Line 47์
Path(".").rglob("*")๋ก ์์ ํธ๋ฆฌ ์ ์ฒด๋ฅผ ํ๊ธฐ ๋๋ฌธ์, ํ์ฌ docstring์ฒ๋ผ ์ถ์ ๋ ํ์ผ๋ง ๊ฒ์ฌํ๋ ๋์์ ์๋๋๋ค. ๋ก์ปฌ quickcheck๊ฐ ์์/๋ฏธ์ถ์ ํ์ผ์ ์ํด ํ๋ค๋ฆด ์ ์์ผ๋, ์ค๋ช ์ ์ค์ ๋์์ ๋ง์ถ๊ฑฐ๋ ํ์ผ ์์ง ๋ก์ง์ ์ถ์ ํ์ผ ๊ธฐ์ค์ผ๋ก ๋ง์ถฐ ์ฃผ์ธ์.์์ ์์ ์
๐ Committable suggestion
๐ค Prompt for AI Agents