Contributions are welcome. Bug reports, performance improvements, and quality enhancements are particularly valued.
swift build # Debug build
swift test # Run all tests
swift package --package-path Benchmarks benchmark # Run benchmark suite (release build)- All tests pass —
swift testmust be green. - Benchmarks checked — If your change touches the scoring pipeline, run
swift package --package-path Benchmarks benchmarkbefore and after. Include the comparison in your PR description. Do not submit performance changes that show no improvement. - Lint clean — The CI runs SwiftLint. Run it locally with
swiftlintif you have it installed. - Focused scope — One concern per PR. Bug fix, feature, or refactor — not all three.
Tests use the Swift Testing framework (@Test macro, #expect() assertions). Test files are in Tests/FuzzyMatchTests/ and mirror the source structure:
EditDistanceTests.swift— Core edit distance algorithmSmithWatermanTests.swift— Smith-Waterman alignment and scoringPrefilterTests.swift/TrigramTests.swift— Fast rejectionScoringBonusTests.swift/WordBoundaryTests.swift— Ranking (edit distance mode)AcronymMatchTests.swift— Word-initial abbreviation matchingHighlightTests.swift— Highlight range extraction for UI displayEdgeCaseTests.swift— Boundary conditions
Run a specific test suite:
swift test --filter EditDistanceTestsAll public APIs must have DocC documentation (/// comments). Include:
- A summary line
- Parameter descriptions
- Return value description
- A usage example for non-trivial APIs
Preview generated documentation:
swift package generate-documentation --target FuzzyMatch- SwiftLint and SwiftFormat are configured in the repo. Follow the existing patterns.
- Don't add comments for self-evident code. Do add comments for non-obvious algorithmic choices.
- Don't add features or abstractions beyond what's needed for the current change.
- Public API additions need DocC documentation (triple-slash comments).
This project uses Conventional Commits for automated releases:
feat: add support for Unicode normalization
fix: correct boundary detection for digits after underscore
perf: vectorize bitmask prefilter
docs: update algorithm documentation for acronym matching
test: add edge cases for empty candidate strings
Breaking changes append !: feat!: rename MatchConfig to ScoringConfig
The hot path (score method) is designed for zero heap allocations after buffer warmup. Changes that introduce per-call allocations need strong justification and benchmark evidence.
If your change affects scoring quality, run the comparison suite and include results:
bash Comparison/run-benchmarks.sh --fm --nucleo --rf
python3 Comparison/run-quality.py --fm --nucleo --rf --fzfSee Comparison/README.md for full setup instructions and prerequisites.
Open an issue for discussion before starting large changes. This saves everyone time.