Repository navigation
Fix download-menu input revalidation - #213
Open
dajiaohuang wants to merge 3 commits into
Open
dajiaohuang wants to merge 3 commits into
dajiaohuang wants to merge 3 commits into
Conversation
…lity - Add explicit UTF-8 encoding to all file I/O operations (fixes Unicode issues) - Add .strip() to all interactive user inputs to handle trailing whitespace - Fix list.index() bug in improve_dictionary using enumerate() for correct dedup - Use context managers (with statement) for proper file handling - Fix hyperspeed print: strip trailing newlines to avoid double-spacing - Use os.name for cross-platform clear command (cls on Windows, clear on Unix) - Fix time.sleep(0000.1) unusual octal literal to clean 0.1 - Remove unreachable dead code after sys.exit() - Fix download_wordlist validation loop (ignored isdigit() return, invalid re-prompt) - Use sum(1 for _ in f) for cleaner line counting
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 4 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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
Narrow this contribution to the actual download-menu validation bug. The original separate digit/range loops can accept an out-of-range number, reprompt with text, and then raise ValueError. Validate every response in one loop against the displayed 1–38 choices. Use isdecimal rather than isdigit so Unicode digit characters that int() cannot parse are rejected; surrounding menu whitespace is accepted.
Removed the unrelated encoding-policy, profile-input stripping, duplicate-word concatenation, output formatting, resource/counting and dead-code changes from the original PR. Their necessity and compatibility were not established for this focused fix. Password-generation behavior remains the original baseline.
Validation
python tests/test_download_choice.py: 3 tests pass. They exercise the real menu function with controlled input/config and a mocked download boundary; no dictionaries are downloaded and no target activity is performed. The previous PR head fails the nondecimal-digit case.git diff --checkpasses.Codacy reports an unresolved gate. Its detailed annotation was not exposed by the current GitHub result; this change does not claim to resolve that report or to pass the full CI suite. No dependency installation or live download acceptance claimed.