From 63813f7fa6674a1cdb9d5c797ea56ac72bb31bae Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:36:26 -0400 Subject: [PATCH 1/8] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index fd3bd9e..612d2d3 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -67,6 +67,7 @@ def test_collects_call_in_nested_module_body(self, tmp_path): def test_collects_function_call_inside_module(self, tmp_path): names = collect_called_names(parse(tmp_path, "module foo(s) { cube(scale(s)); }")) + assert "cube" in names assert "scale" in names assert "cube" in names From 776771b1d4199a2912fa62cf172ffbd53c87df28 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:36:26 -0400 Subject: [PATCH 2/8] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 612d2d3..346a657 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -1,13 +1,14 @@ """Unit tests for openscad_packer.shaker.""" from pathlib import Path from typing import Any +from typing import Any from openscad_parser.ast import getASTfromFile from openscad_parser.ast.nodes import FunctionDeclaration, ModuleDeclaration from openscad_packer.shaker import collect_called_names, compute_reachable - +def parse(tmp_path: Path, content: str) -> list[Any]: def parse(tmp_path: Path, content: str) -> list[Any]: f = tmp_path / "test.scad" f.write_text(content) From c27f053662c2105e25d746042c1bf83c92043a27 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:41:43 -0400 Subject: [PATCH 3/8] Fix corrupted test_shaker.py from bad Copilot Autofix patches Remove duplicate `def parse` header that caused an IndentationError (breaking all 23 tests), duplicate `from typing import Any` import, and duplicate `assert "cube" in names` assertion. Co-Authored-By: Claude Sonnet 4.6 --- tests/test_shaker.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 346a657..fd3bd9e 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -1,14 +1,13 @@ """Unit tests for openscad_packer.shaker.""" from pathlib import Path from typing import Any -from typing import Any from openscad_parser.ast import getASTfromFile from openscad_parser.ast.nodes import FunctionDeclaration, ModuleDeclaration from openscad_packer.shaker import collect_called_names, compute_reachable -def parse(tmp_path: Path, content: str) -> list[Any]: + def parse(tmp_path: Path, content: str) -> list[Any]: f = tmp_path / "test.scad" f.write_text(content) @@ -68,7 +67,6 @@ def test_collects_call_in_nested_module_body(self, tmp_path): def test_collects_function_call_inside_module(self, tmp_path): names = collect_called_names(parse(tmp_path, "module foo(s) { cube(scale(s)); }")) - assert "cube" in names assert "scale" in names assert "cube" in names From 878e7e1bee46cb6b8b8e9e42c50b374a77f33e66 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:43:11 -0400 Subject: [PATCH 4/8] Potential fixes for 2 code quality findings (#13) * Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Fix corrupted test_shaker.py from bad Copilot Autofix patches Remove duplicate `def parse` header that caused an IndentationError (breaking all 23 tests), duplicate `from typing import Any` import, and duplicate `assert "cube" in names` assertion. Co-Authored-By: Claude Sonnet 4.6 --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 From eac65d56cc7dc7c07d55e751be5168c6217184bd Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:46:14 -0400 Subject: [PATCH 5/8] Apply suggested fix to tests/test_shaker.py from Copilot Autofix (#14) Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index fd3bd9e..c867809 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -15,7 +15,10 @@ def parse(tmp_path: Path, content: str) -> list[Any]: def make_pool(tmp_path: Path, content: str) -> dict[str, list]: - """Parse content and return a list-valued pool dict (mirrors _add_to_pool logic).""" + """Parse content and return a list-valued pool dict. + + This mirrors the private ``_add_to_pool`` behavior in ``openscad_packer.shaker``. + """ nodes = parse(tmp_path, content) pool: dict[str, list] = {} for node in nodes: From 7b776baffa0e6ae89310c38dae17d1acbbbcdded Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:47:38 -0400 Subject: [PATCH 6/8] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index c867809..4153b54 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -98,8 +98,9 @@ def test_collects_chained_calls(self, tmp_path): def test_does_not_collect_non_identifier_primary_calls(self, tmp_path): # (function(x) x*2)(5) — PrimaryCall where left is a FunctionLiteral, not Identifier names = collect_called_names(parse(tmp_path, "y = (function(x) x*2)(5);")) - # No Identifier on the left side, so nothing collected from the call itself + # No Identifier on the left side, so nothing should be collected assert "function" not in names + assert names == set() class TestComputeReachable: From 5a4dcc11f424d04edfcff11736cde4e3a4d0f877 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:47:38 -0400 Subject: [PATCH 7/8] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 4153b54..dbe9983 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -9,9 +9,9 @@ def parse(tmp_path: Path, content: str) -> list[Any]: - f = tmp_path / "test.scad" - f.write_text(content) - return getASTfromFile(str(f), process_includes=False) or [] + test_file = tmp_path / "test.scad" + test_file.write_text(content) + return getASTfromFile(str(test_file), process_includes=False) or [] def make_pool(tmp_path: Path, content: str) -> dict[str, list]: From 2b4d0173876dedaf17198b4c335a194fe05b8a61 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:54:16 -0400 Subject: [PATCH 8/8] Fix docstring module reference and redundant assertion in test_shaker.py Correct _add_to_pool module reference from openscad_packer.shaker to openscad_packer.packer, remove the redundant assert that was fully subsumed by the equality check, and clarify why the result is empty. Co-Authored-By: Claude Sonnet 4.6 --- tests/test_shaker.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index dbe9983..75ed3f4 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -17,7 +17,7 @@ def parse(tmp_path: Path, content: str) -> list[Any]: def make_pool(tmp_path: Path, content: str) -> dict[str, list]: """Parse content and return a list-valued pool dict. - This mirrors the private ``_add_to_pool`` behavior in ``openscad_packer.shaker``. + This mirrors the private ``_add_to_pool`` behavior in ``openscad_packer.packer``. """ nodes = parse(tmp_path, content) pool: dict[str, list] = {} @@ -98,8 +98,9 @@ def test_collects_chained_calls(self, tmp_path): def test_does_not_collect_non_identifier_primary_calls(self, tmp_path): # (function(x) x*2)(5) — PrimaryCall where left is a FunctionLiteral, not Identifier names = collect_called_names(parse(tmp_path, "y = (function(x) x*2)(5);")) - # No Identifier on the left side, so nothing should be collected - assert "function" not in names + # The callee is a FunctionLiteral (not an Identifier), so the call site + # contributes nothing. The body x*2 has no inner calls either, so the + # full result must be empty. assert names == set()