Skip to content

Commit 5f3fee6

Browse files
authored
refactor: delete dead code and stale migration narrative (3.0 readiness) (#233)
Dead code (no caller in lib, test or docs): - ScreenshotAssertion.assert_image_not_changed - ScreenshotNamer#full_name_with_path / #current_group_directory, and the @screenshot_area duplication of Config#screenshot_area they were the only users of - three pure pass-throughs on Reporters::Default (save_annotation_for, annotate_difference, annotate_skip_areas) plus #save - VipsDriver.difference_area - Deprecation.warn's category: kwarg (one value in the tree) Structural: - AssertionRegistry#verify drops the guard verify_screenshots! already applies and stops computing failed_assertions.first outside the branch that reads it - DSL inlines two empty private hops (build_screenshot_assertion, screenshot_namer) Narrative: collapsed the 20 boilerplate ADR-step forwarder headers under lib/capybara* to one line each and stripped migration chronology from snap_diff.rb, dsl.rb, capybara_screenshot_diff.rb, legacy_shims.rb, image_compare.rb, capture/viewport.rb, screenshoter.rb and snap_manager.rb, keeping the live constraints. rake test:unit 532 -> 522, rake test 565 -> 555, both 0 failures.
1 parent 02e281e commit 5f3fee6

39 files changed

Lines changed: 103 additions & 310 deletions
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
# Forwarder (ADR-004 v2 step 6): Capybara::Screenshot::Diff::AnnotationService
4-
# now resolves lazily via snap_diff/legacy_shims' const_missing, with a
5-
# deprecation warning pointing at SnapDiff::AnnotationService.
3+
# Legacy-name forwarder: the old constant resolves via snap_diff/legacy_shims.
64
require "snap_diff/annotation_service"
75
require "snap_diff/legacy_shims"
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
# Forwarder (ADR-004 v2 step 6): Capybara::Screenshot::Diff::AreaCalculator
4-
# now resolves lazily via snap_diff/legacy_shims' const_missing, with a
5-
# deprecation warning pointing at SnapDiff::AreaCalculator.
3+
# Legacy-name forwarder: the old constant resolves via snap_diff/legacy_shims.
64
require "snap_diff/area_calculator"
75
require "snap_diff/legacy_shims"
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
# Forwarder (ADR-004 v2 step 6): Capybara::Screenshot::BrowserHelpers now
4-
# resolves lazily via snap_diff/legacy_shims' const_missing, with a
5-
# deprecation warning pointing at SnapDiff::BrowserHelpers.
3+
# Legacy-name forwarder: the old constant resolves via snap_diff/legacy_shims.
64
require "snap_diff/browser_helpers"
75
require "snap_diff/legacy_shims"
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# frozen_string_literal: true
22

3-
# Forwarder (ADR-004 v2 step 6): the comparison-result value object lives at
4-
# SnapDiff::ComparisonResult (ex-Difference); the old name now resolves
5-
# lazily via snap_diff/legacy_shims' const_missing, with a deprecation
6-
# warning.
3+
# Legacy-name forwarder: the old constant resolves via snap_diff/legacy_shims.
74
require "snap_diff/comparison_result"
85
require "snap_diff/legacy_shims"
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# frozen_string_literal: true
22

3-
# Forwarder (ADR-004 v2 step 6): Capybara::Screenshot::Diff::Drivers now
4-
# resolves lazily via snap_diff/legacy_shims' const_missing, with a
5-
# deprecation warning pointing at SnapDiff::Drivers. The forwarded module is
6-
# the same object, so Drivers.for and the Drivers::VipsDriver /
7-
# Drivers::ChunkyPNGDriver constants keep resolving through the old name.
3+
# Legacy-name forwarder: the old constant resolves via snap_diff/legacy_shims.
4+
# The forwarded module is the same object, so Drivers.for and the
5+
# Drivers::VipsDriver / Drivers::ChunkyPNGDriver constants keep resolving
6+
# through the old name.
87
require "snap_diff/drivers"
98
require "snap_diff/legacy_shims"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

3-
# Forwarder (ADR-004 v2 step 4): ChunkyPNGDriver lives in SnapDiff::Drivers
4-
# now; the module alias in capybara/screenshot/diff/drivers.rb makes it
5-
# reachable as Capybara::Screenshot::Diff::Drivers::ChunkyPNGDriver.
3+
# Legacy-name forwarder: the module alias in capybara/screenshot/diff/drivers.rb
4+
# makes ChunkyPNGDriver reachable as
5+
# Capybara::Screenshot::Diff::Drivers::ChunkyPNGDriver.
66
require "capybara/screenshot/diff/drivers"
77
require "snap_diff/drivers/chunky_png_driver"
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Forwarder (ADR-004 v2 step 4): VipsDriver lives in SnapDiff::Drivers now;
4-
# the module alias in capybara/screenshot/diff/drivers.rb makes it reachable
5-
# as Capybara::Screenshot::Diff::Drivers::VipsDriver.
3+
# Legacy-name forwarder: the module alias in capybara/screenshot/diff/drivers.rb
4+
# makes VipsDriver reachable as Capybara::Screenshot::Diff::Drivers::VipsDriver.
65
require "capybara/screenshot/diff/drivers"
76
require "snap_diff/drivers/vips_driver"

lib/capybara/screenshot/diff/image_compare.rb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
# frozen_string_literal: true
22

3-
# Forwarder (ADR-004 v2 step 6): the comparison class lives at
4-
# SnapDiff::Comparison (ex-ImageCompare); the old name now resolves lazily
5-
# via snap_diff/legacy_shims' const_missing, with a deprecation warning.
6-
# snap_diff/comparison itself pulls in the ComparisonResult and Drivers
7-
# units, and the shims keep the old ::Difference / ::Drivers names
8-
# resolvable, so this path still provides everything the pre-move
9-
# image_compare.rb did. The images-holder struct lives at
10-
# SnapDiff::Comparison::Images and the driver cache at
11-
# SnapDiff::Drivers.loaded, with LOADED_DRIVERS kept as an eager same-object
12-
# alias by legacy_shims (ADR-008 step 5).
3+
# Legacy-name forwarder for SnapDiff::Comparison (ex-ImageCompare). Requiring
4+
# this path must keep providing everything the pre-move image_compare.rb did:
5+
# snap_diff/comparison pulls in the ComparisonResult and Drivers units, and the
6+
# shims keep ::Difference, ::Drivers, ::Comparison (the images struct) and
7+
# LOADED_DRIVERS resolvable.
138
require "snap_diff/comparison"
149
require "snap_diff/legacy_shims"
1510

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
# Forwarder (ADR-004 v2 step 6): Capybara::Screenshot::Diff::ImagePreprocessor
4-
# now resolves lazily via snap_diff/legacy_shims' const_missing, with a
5-
# deprecation warning pointing at SnapDiff::ImagePreprocessor.
3+
# Legacy-name forwarder: the old constant resolves via snap_diff/legacy_shims.
64
require "snap_diff/image_preprocessor"
75
require "snap_diff/legacy_shims"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

3-
# Forwarder (ADR-008 step 3): Region now lives at SnapDiff::Region;
4-
# snap_diff/region also defines the eager top-level `Region` alias.
3+
# Legacy-name forwarder: snap_diff/region also defines the eager top-level
4+
# `Region` alias.
55
require "snap_diff/region"

0 commit comments

Comments
 (0)