Document Swift as a supported language.

The scan already reports Swift pairs in the text report and in
.metrics/dry.edn. The help text, the language table, and the project
description still listed the previous six languages.

Proved: test_help_does_not_scan failed until the help named
Swift (.swift) and *Tests.swift, then passed. test_swift_report_writes_the_same_snapshot
checks the text lines and :language \"swift\" in dry.edn. The shared
language tests now include Swift. 92 tests passed.

Co-authored-by: Robert C. Martin <[email protected]>
This commit is contained in:
Cursor Agent
2026-11-25 23:35:40 +00:00
co-authored by Robert C. Martin
parent f667ad03ba
commit 1bb1936ad5
9 changed files with 78 additions and 17 deletions
+15
View File
@@ -1,5 +1,6 @@
from pathlib import Path
from dryer.cli import run
from dryer.discover import iter_source_files, language_of
from dryer.extract import entries_in_source
from dryer.scan import find_duplicates, scan_files
@@ -297,6 +298,20 @@ def test_swiftui_views_match_when_only_the_data_changes(tmp_path):
assert _scored(tmp_path, RECEIPT, LABEL_VIEW) < 1.0
def test_swift_report_writes_the_same_snapshot(tmp_path, capsys):
write_source(tmp_path, "left.swift", SWIFT_LEFT)
write_source(tmp_path, "right.swift", SWIFT_RIGHT)
assert run(["--root", str(tmp_path)]) == 0
captured = capsys.readouterr()
assert "DUPLICATE score=1.00" in captured.out
assert "left.swift:1-4" in captured.out
assert "right.swift:1-4" in captured.out
text = (tmp_path / ".metrics" / "dry.edn").read_text(encoding="utf-8")
assert ':language "swift"' in text
assert ':file "left.swift"' in text
assert "Wrote" in captured.err
def test_a_swift_package_skips_its_tests(tmp_path):
body = "func alpha() -> Int {\n return 1\n}\n"
write_source(tmp_path, "Sources/App.swift", body)