refactor(typosquat): split typosquat.rs into a submodule directory (#69)#71
Open
Metbcy wants to merge 1 commit into
Open
refactor(typosquat): split typosquat.rs into a submodule directory (#69)#71Metbcy wants to merge 1 commit into
Metbcy wants to merge 1 commit into
Conversation
src/enrich/typosquat.rs was 1197 LOC, over the 1000-LOC soft cap in the module size budget. Split it into src/enrich/typosquat/ mirroring the enrich/maintainer/ split from the #57 series: mod.rs owns the TyposquatFinding type, the embedded list constants, and the public enrich entry points, with ecosystem.rs (the SupportedEcosystem enum), canonical.rs (name normalization), matching.rs (Jaro-Winkler and Maven Levenshtein scoring), lists.rs (reference-list loading), and tests.rs. Pure mechanical move, no behavior change. The public surface stays reachable at crate::enrich::typosquat::* (TyposquatFinding, enrich, enrich_with_threshold, SIMILARITY_THRESHOLD) and pub mod typosquat; in enrich/mod.rs is unchanged. Cross-module helpers are pub(super). Closes #69.
Coverage reportLine coverage: 83.1% (8800 / 10586 lines) Full lcov report available as workflow artifact coverage-lcov: download from this run. v0.9.8 introduces this report; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits the 1197-LOC
src/enrich/typosquat.rsinto asrc/enrich/typosquat/submodule directory, the next file over the 1000-LOC soft cap after the #57 series. Closes #69.Pure mechanical move: no logic, threshold, or string literal changed. The layout mirrors PR #64 (maintainer/).
Layout
mod.rsTyposquatFinding, the embedded list constants and tuning constants, and the publicenrich/enrich_with_threshold/check_oneentry pointsecosystem.rsSupportedEcosystemenum and its list / separator / cache mappingscanonical.rsmatching.rslists.rstests.rs#[cfg(test)] mod testsblock, moved verbatimWhy
typosquat.rswas the second-largest non-test file over the soft cap. The split separates the scoring algorithms, ecosystem handling, and list loading into their own files per the budget rule indocs/src/architecture.md.Compatibility
The public surface stays reachable at the same paths (
crate::enrich::typosquat::{TyposquatFinding, enrich, enrich_with_threshold, SIMILARITY_THRESHOLD}).pub mod typosquat;insrc/enrich/mod.rsis unchanged. Cross-module helpers arepub(super); theinclude_str!paths for the embedded lists were repointed one level deeper.Testing
cargo build --all-targets --all-features(RUSTFLAGS="-D warnings"): cleancargo clippy --all-targets --all-features -- -D warnings: cleancargo test --all-features: 441 lib + 36 cli + 9 integration + 7 real_world + 1 doc, all passcargo fmt --all --check: cleanCloses #69.