Miscellaneous low-priority fixes#121
Merged
Merged
Conversation
The outer guard `shifted_count&.positive?` ensures `shifted > 0`, so `shifted.zero?` can never be true. Dead code carried over from the JS port.
Add `.sort.to_h` to match the README and old behaviour — `to_hash` returned keys sorted alphabetically. Also clarify that splatting a match or passing it to `Hash()` now raises `TypeError`.
Document that frequency lists are English-only and that non-English passwords may score higher than the real-world risk warrants.
`password.length == 1` didn't cover length 0, relying on the loop producing nil deltas to accidentally return []. Use `< 2` instead.
Score#inspect was showing the full password via Data.define's default. Match#inspect was including token (a password substring). Both now suppress these fields, matching the pattern already on Tester.
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.
Context
Several small issues exist across the codebase: dead code from the JS port, missing guards, undocumented edge cases, a documentation inconsistency, and plaintext leaking via
inspect.Changes
shifted.zero?branch inspatial_guesses(dead code from JS port)== 1→< 2)expand_yearboundary condition and negative-year edge caseto_hashmigration snippet in CHANGELOG (missing.sort.to_h)passwordfromScore#inspectandtokenfromMatch#inspectConsequences
Dead code is removed. Empty passwords no longer rely on accidental behaviour in the sequence matcher. Callers are warned about non-English scoring limitations. The CHANGELOG migration snippet now correctly replicates alphabetical key ordering. Plaintext passwords and tokens no longer appear in
inspectoutput.