Skip to content

Commit d799ddc

Browse files
author
GitHub Copilot
committed
Remove redundant scanner facade alias seams
1 parent 05157d5 commit d799ddc

3 files changed

Lines changed: 19 additions & 43 deletions

File tree

src/prism/scanner.py

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,12 @@
8282
from .scanner_analysis import (
8383
build_scanner_report_markdown as _runbook_report_build_scanner_report_markdown,
8484
extract_scanner_counters as _analysis_extract_scanner_counters,
85-
build_runbook_rows as _analysis_build_runbook_rows,
8685
render_runbook as _runbook_report_render_runbook,
8786
render_runbook_csv as _runbook_report_render_runbook_csv,
8887
)
8988
from .scanner_readme import (
9089
_append_scanner_report_section_if_enabled as _readme_append_scanner_report_section_if_enabled,
91-
_compose_section_body as _readme_compose_section_body,
92-
_generated_merge_markers as _readme_generated_merge_markers,
93-
_render_guide_identity_sections as _readme_render_guide_identity_sections,
9490
_render_guide_section_body as _readme_render_guide_section_body,
95-
_render_readme_with_style_guide as _readme_render_readme_with_style_guide,
96-
_resolve_ordered_style_sections as _readme_resolve_ordered_style_sections,
97-
_resolve_section_content_mode as _readme_resolve_section_content_mode,
98-
_strip_prior_generated_merge_block as _readme_strip_prior_generated_merge_block,
9991
normalize_style_heading,
10092
parse_style_readme,
10193
)
@@ -899,24 +891,15 @@ def load_readme_section_config(
899891
)
900892

901893

902-
_render_guide_identity_sections = _readme_render_guide_identity_sections
903-
904-
905894
_render_guide_section_body = partial(
906895
_readme_render_guide_section_body,
907896
variable_guidance_keywords=_VARIABLE_GUIDANCE_KEYWORDS,
908897
)
909898

910899

911-
_generated_merge_markers = _readme_generated_merge_markers
912-
_strip_prior_generated_merge_block = _readme_strip_prior_generated_merge_block
913-
_resolve_section_content_mode = _readme_resolve_section_content_mode
914-
_compose_section_body = _readme_compose_section_body
915-
_resolve_ordered_style_sections = _readme_resolve_ordered_style_sections
916900
_append_scanner_report_section_if_enabled = (
917901
_readme_append_scanner_report_section_if_enabled
918902
)
919-
_render_readme_with_style_guide = _readme_render_readme_with_style_guide
920903

921904

922905
_build_scanner_report_markdown = partial(
@@ -925,15 +908,6 @@ def load_readme_section_config(
925908
)
926909

927910

928-
_extract_scanner_counters = _analysis_extract_scanner_counters
929-
930-
931-
_build_runbook_rows = _analysis_build_runbook_rows
932-
933-
934-
_build_requirements_display = _runbook_report_build_requirements_display
935-
936-
937911
_resolve_scan_identity = partial(
938912
_scan_discovery_resolve_scan_identity,
939913
load_meta_fn=load_meta,
@@ -974,29 +948,22 @@ def _apply_readme_section_config(
974948
)
975949

976950

977-
_attach_external_vars_context = _variable_insights.attach_external_vars_context
978-
979-
980951
_build_undocumented_default_filters = partial(
981952
_variable_insights.build_undocumented_default_filters,
982953
extract_default_target_var=_extract_default_target_var,
983954
looks_secret_name=_looks_secret_name,
984955
resembles_password_like=_resembles_password_like,
985956
)
986957

987-
988-
_build_display_variables = _variable_insights.build_display_variables
989-
990-
991958
_collect_variable_insights_and_default_filter_findings = partial(
992959
_variable_insights.collect_variable_insights_and_default_filter_findings,
993960
build_variable_insights=build_variable_insights,
994-
attach_external_vars_context=_attach_external_vars_context,
961+
attach_external_vars_context=_variable_insights.attach_external_vars_context,
995962
collect_yaml_parse_failures=_collect_yaml_parse_failures,
996963
extract_role_notes_from_comments=_extract_role_notes_from_comments,
997964
build_undocumented_default_filters=_build_undocumented_default_filters,
998-
extract_scanner_counters=_extract_scanner_counters,
999-
build_display_variables=_build_display_variables,
965+
extract_scanner_counters=_analysis_extract_scanner_counters,
966+
build_display_variables=_variable_insights.build_display_variables,
1000967
)
1001968

1002969

@@ -1043,7 +1010,7 @@ def _apply_readme_section_config(
10431010

10441011
_apply_scan_metadata_configuration = partial(
10451012
_scan_runtime.apply_scan_metadata_configuration,
1046-
build_requirements_display=_build_requirements_display,
1013+
build_requirements_display=_runbook_report_build_requirements_display,
10471014
load_readme_section_config=load_readme_section_config,
10481015
apply_readme_section_config=_apply_readme_section_config,
10491016
)

src/prism/tests/test_scan_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_scanner_variable_insight_collection_helper_is_flattened_partial_alias()
102102
assert helper.keywords["build_variable_insights"] is scanner.build_variable_insights
103103
assert (
104104
helper.keywords["attach_external_vars_context"]
105-
is scanner._attach_external_vars_context
105+
is scanner._variable_insights.attach_external_vars_context
106106
)
107107
assert (
108108
helper.keywords["collect_yaml_parse_failures"]

src/prism/tests/test_scanner_internals.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,17 +1149,25 @@ def test_variable_extractor_wrapper_re_exports_canonical_implementation():
11491149

11501150

11511151
def test_variable_insights_wrappers_re_export_canonical_implementations():
1152-
"""Variable-insights scanner helpers should be canonical scanner_core aliases."""
1152+
"""Variable-insights helpers resolve directly from canonical scanner_core."""
11531153
from prism.scanner_core import variable_insights as canonical
11541154

11551155
assert (
1156-
scanner._attach_external_vars_context is canonical.attach_external_vars_context
1156+
scanner._collect_variable_insights_and_default_filter_findings.keywords[
1157+
"attach_external_vars_context"
1158+
]
1159+
is canonical.attach_external_vars_context
1160+
)
1161+
assert (
1162+
scanner._collect_variable_insights_and_default_filter_findings.keywords[
1163+
"build_display_variables"
1164+
]
1165+
is canonical.build_display_variables
11571166
)
1158-
assert scanner._build_display_variables is canonical.build_display_variables
11591167

11601168

11611169
def test_runbook_bridge_wrappers_re_export_canonical_implementations():
1162-
"""Runbook helper bridge keeps only canonical row helper on scanner module."""
1170+
"""Runbook helper bridge keeps canonical module behavior and no facade wrappers."""
11631171
from prism.scanner_analysis import (
11641172
build_runbook_rows,
11651173
)
@@ -1174,7 +1182,8 @@ def test_runbook_bridge_wrappers_re_export_canonical_implementations():
11741182
]
11751183
}
11761184

1177-
assert scanner._build_runbook_rows(metadata) == build_runbook_rows(metadata)
1185+
rows = build_runbook_rows(metadata)
1186+
assert isinstance(rows, list)
11781187
assert not hasattr(scanner, "render_runbook")
11791188
assert not hasattr(scanner, "render_runbook_csv")
11801189

0 commit comments

Comments
 (0)