Fix random-password entropy and exclusions - #7
Conversation
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. 📝 WalkthroughWalkthroughThe change adds a shared password utility module with filtered generation and exact entropy calculation, integrates it into CLI and web flows, adds focused tests, and updates entropy documentation and compilation checks. ChangesPassword generation and entropy
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI_or_Web
participant passwords
participant Output
CLI_or_Web->>passwords: calculate_password_entropy(length, flags, exclusions)
passwords-->>CLI_or_Web: exact entropy
CLI_or_Web->>passwords: generate_password(length, flags, exclusions)
passwords-->>CLI_or_Web: generated password
CLI_or_Web->>Output: render password and entropy
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
README.md (1)
152-171: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winProject structure tree is now stale.
This PR adds
passwords.pyandtests/test_passwords.py, but the documented tree still omits both.📝 Proposed doc update
password-generator/ ├── .github/workflows/ci.yml ├── docs/web-ui.png ├── main.py ├── passphrases.py +├── passwords.py ├── web.py ├── templates/index.html ├── tests/ │ ├── test_main.py │ ├── test_passphrases.py +│ ├── test_passwords.py │ └── test_web.py ├── wordlists/ │ ├── eff_large_wordlist.txt │ └── README.md ├── pyproject.toml └── README.md🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` around lines 152 - 171, Update the Project structure tree in README.md to include the new passwords.py module and tests/test_passwords.py entry, placing each alongside the corresponding existing source and test files.main.py (1)
216-237: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate
generate_passphraseimplementation inmain.pyandweb.py. Both files independently implement the same word-selection/capitalize/number-suffix logic; this PR already centralized the equivalent random-password logic intopasswords.py, but passphrase generation was left duplicated.
main.py#L216-L237: extract thisgenerate_passphraseimplementation into a shared module (e.g. alongsidecalculate_passphrase_entropyinpassphrases.py) and import it here instead of defining it locally.web.py#L27-L39: remove this duplicategenerate_passphraseand import the same shared implementation used by the CLI.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@main.py` around lines 216 - 237, The passphrase-generation logic is duplicated across the CLI and web paths. In main.py lines 216-237, move generate_passphrase into the shared passphrases.py module alongside calculate_passphrase_entropy and import it instead of defining it locally; in web.py lines 27-39, remove the duplicate generate_passphrase and import the same shared implementation, preserving its existing word selection, capitalization, number suffix, validation, and return behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@main.py`:
- Around line 216-237: The passphrase-generation logic is duplicated across the
CLI and web paths. In main.py lines 216-237, move generate_passphrase into the
shared passphrases.py module alongside calculate_passphrase_entropy and import
it instead of defining it locally; in web.py lines 27-39, remove the duplicate
generate_passphrase and import the same shared implementation, preserving its
existing word selection, capitalization, number suffix, validation, and return
behavior.
In `@README.md`:
- Around line 152-171: Update the Project structure tree in README.md to include
the new passwords.py module and tests/test_passwords.py entry, placing each
alongside the corresponding existing source and test files.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 55968558-3e68-44cc-8f9a-1bceea7da493
📒 Files selected for processing (8)
.github/workflows/ci.ymlREADME.mdmain.pypasswords.pytests/test_main.pytests/test_passwords.pytests/test_web.pyweb.py
Summary
Verification
main.py,web.py,passphrases.py, andpasswords.pygit diff --checkpassedSummary by CodeRabbit
New Features
Documentation
Tests