Repository navigation
Keep static_analysis.pkl across runs; add fresh_analysis input #172
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| from threading import Thread | ||
|
|
||
| PROG = "codeboarding" | ||
| STATIC_CACHE = {"static_analysis.pkl", "static_analysis.sha"} | ||
|
Member
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. We have a warning on this, that we have hardcoded it multiple times. |
||
| # Shared with CodeBoarding/codeboarding_cli/main.py; keep the prefix in sync. | ||
| ENGINE_ERROR_PREFIX = "CodeBoarding: " | ||
|
|
||
|
|
@@ -133,6 +134,9 @@ def main(argv: list[str] | None = None) -> int: | |
| parser.add_argument("--checkout", required=True, help="Path to repository checkout") | ||
| parser.add_argument("--output-dir", required=True, help="Action-owned output directory") | ||
| parser.add_argument("--depth-cap", help="Maximum hierarchy depth allowed for full analyses") | ||
| parser.add_argument( | ||
| "--fresh", action="store_true", help="Full analysis from nothing, not even the static-analysis cache" | ||
|
Member
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. in the core isn't this the |
||
| ) | ||
|
|
||
| args = parser.parse_args(argv) | ||
| checkout = Path(args.checkout) | ||
|
|
@@ -151,19 +155,18 @@ def main(argv: list[str] | None = None) -> int: | |
|
|
||
| if not args.depth_cap: | ||
| raise SystemExit("--depth-cap is required for mode=full") | ||
| shutil.rmtree(output_dir) | ||
| output_dir.mkdir(parents=True) | ||
| command = [ | ||
| PROG, | ||
| "full", | ||
| "--local", | ||
| str(checkout), | ||
| "--output-dir", | ||
| str(output_dir), | ||
| "--depth-cap", | ||
| args.depth_cap, | ||
| "--force", | ||
|
Member
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. effectively this parameter for my comment from above. |
||
| ] | ||
| # Core validates the static-analysis cache itself: one from another cache | ||
| # version is refused and rebuilt, so it survives every full run but a fresh one. | ||
| for entry in output_dir.iterdir(): | ||
| if not args.fresh and entry.name in STATIC_CACHE: | ||
| continue | ||
| if entry.is_dir() and not entry.is_symlink(): | ||
| shutil.rmtree(entry) | ||
| else: | ||
| entry.unlink() | ||
| command = [PROG, "full", "--local", str(checkout), "--output-dir", str(output_dir), "--depth-cap", args.depth_cap] | ||
| if args.fresh: | ||
| command.append("--force") | ||
| _run_command(command, output_dir) | ||
| analysis_path = output_dir / "analysis.json" | ||
| if not analysis_path.is_file(): | ||
|
|
||
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.
i am fine with fresh, although i am not sure this is the proper lingo, it sounds a bit odd.
I am more used to things like invalidate/force ;d, we can keep it fresh as well just mentioning. And it doesn't align with our core lingo where I think we call this force