fix: support duplicate option names with different values#214
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR detects duplicated non-absent bootloader option names, reconciles kernel grubby args to the deduplicated expected tokens, and adds unit tests covering detection and mod_boot_args command generation scenarios. ChangesDuplicate bootloader option handling
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #214 +/- ##
==========================================
+ Coverage 78.43% 79.94% +1.51%
==========================================
Files 2 3 +1
Lines 255 344 +89
==========================================
+ Hits 200 275 +75
- Misses 55 69 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f52c098 to
62d5bac
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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.
Inline comments:
In `@library/bootloader_settings.py`:
- Around line 327-351: Run the style checks (tox -e black,flake8) and fix PEP8
violations: move any module-level imports currently located mid-file up to the
top of the module to resolve E402, and wrap or reformat long lines to be under
79/88 chars to resolve E501; specifically inspect and reformat code around the
functions get_duplicate_present_option_names and find_boot_arg_tokens (and
surrounding code) so their logic remains identical but line lengths and import
positions comply with Black/flake8, then re-run black to ensure consistent
formatting.
- Around line 344-351: The regex pattern in find_boot_arg_tokens concatenates
the raw name into the pattern, so metacharacters in the option name (e.g., dots)
can change matching; update the pattern construction to use an escaped version
of name (e.g., re.escape(name)) when building pattern so dots and other regex
metacharacters are treated literally, while preserving the existing overall
pattern logic (the function find_boot_arg_tokens and its pattern variable are
where to change).
In `@tests/unit/test_bootloader_settings.py`:
- Around line 457-589: Several test lines exceed the 79-char limit (E501) in
tests like test_get_duplicate_present_option_names and
test_duplicate_option_names where long literal strings and
assert_called_once_with arguments (e.g., the "grubby --update-kernel=ALL ..."
calls and the multi-line info_* vars) are used; shorten them by breaking long
strings into implicit adjacent literals or concatenating with +, wrap long
command/assert strings across multiple quoted parts, or use dedented short
variables (e.g., info_empty_args, info_one_console, info_both_consoles) split
into multiple shorter lines so each line is <=79 chars, then run tox -e
black,flake8 to verify compliance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ed8b95d8-5871-4176-89bc-0ea455f78d0c
📒 Files selected for processing (2)
library/bootloader_settings.pytests/unit/test_bootloader_settings.py
|
[citest] |
|
fixes #191 |
Cause: The code would only use the last option if multiple options were passed with the same name but different values. Consequence: The user cannot configure the kernel command line with multiple options having different values e.g. "console=tty0 console=ttyS0" Fix: Ensure that multiple duplicate options with different values can be passed. Result: User can configure the kernel command line with multiple duplicate options with different values. Assisted-by: Cursor IDE using the models Composer 2.5, Codex 5.3, and Sonnet 4.6 Signed-off-by: Rich Megginson <rmeggins@redhat.com>
|
[citest] |
Cause: The code would only use the last option if multiple options were passed with the same
name but different values.
Consequence: The user cannot configure the kernel command line with multiple options having
different values e.g. "console=tty0 console=ttyS0"
Fix: Ensure that multiple duplicate options with different values can be passed.
Result: User can configure the kernel command line with multiple duplicate options
with different values.
Signed-off-by: Rich Megginson rmeggins@redhat.com
Assisted-by: Cursor IDE using the models Composer 2.5, Codex 5.3, and Sonnet 4.6
Summary by CodeRabbit
Bug Fixes
Tests