Fix supported command on Elixir modules#9
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR changes Elixir module-name handling: it uses the two-argument normalizer (with an Elixir flag) in spectrometer_utils, applies that normalization in the CLI for --module/-m, updates help text with examples, and adds/updates EUnit tests validating the behavior. ChangesElixir Module Normalization and CLI Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
f13aa83 to
1c36b49
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
test/spectrometer_elixir_tests.erl (1)
69-73: ⚡ Quick winAdd binary-input coverage for
is_elixir_module_name/1.The production change updated separate list and binary branches, but these assertions only hit string inputs. A quick
<<"GPIO">>/<<"lists">>pair would cover the new binary path too.🤖 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 `@test/spectrometer_elixir_tests.erl` around lines 69 - 73, The test is only exercising the string branch of spectrometer_utils:is_elixir_module_name/1; add assertions in is_elixir_module_name_case_test to also call spectrometer_utils:is_elixir_module_name/1 with binary inputs (e.g. <<"GPIO">> should assert true and <<"lists">> should assert false) so the new binary branch is covered alongside the existing string assertions; keep the test name and pattern and place the new ?assertEqual checks next to the existing calls.test/atomvm_spectrometer_tests.erl (1)
458-475: ⚡ Quick winCover the
--moduleElixir path as well.This new test only exercises
-m, but the parser change touched both-mand--module. Adding one["supported", "--module", "List"]assertion would lock down the long-form branch too.🤖 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 `@test/atomvm_spectrometer_tests.erl` around lines 458 - 475, The test parse_supported_args_elxir_module_test_() exercises only the short flag "-m" but not the long form "--module"; update the test to also call atomvm_spectrometer:parse_args with ["supported", "--module", "List"] and assert (via maps:get(module, OptsX)) that the parsed module is <<"Elixir.List">> to cover the long-form branch of the parser (also add a similar check for already-prefixed "Elixir.List" and for lowercase "lists" if desired to mirror the existing short-flag cases).
🤖 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 `@src/spectrometer_utils.erl`:
- Around line 412-418: Update the `@doc` for is_elixir_module_name/1 to reflect
the new semantics: describe that the function calls normalize_module_name(Bin,
true) and returns true not only when the normalized binary literally starts with
"Elixir." but also when normalization maps capitalized short names (e.g.,
"GPIO") into Elixir module names (i.e., normalization may prepend "Elixir." or
otherwise convert capitalized identifiers into Elixir module form). Reference
normalize_module_name/2 and is_elixir_module_name/1 in the doc so readers
understand the check is performed on the normalized result rather than the
original input.
---
Nitpick comments:
In `@test/atomvm_spectrometer_tests.erl`:
- Around line 458-475: The test parse_supported_args_elxir_module_test_()
exercises only the short flag "-m" but not the long form "--module"; update the
test to also call atomvm_spectrometer:parse_args with ["supported", "--module",
"List"] and assert (via maps:get(module, OptsX)) that the parsed module is
<<"Elixir.List">> to cover the long-form branch of the parser (also add a
similar check for already-prefixed "Elixir.List" and for lowercase "lists" if
desired to mirror the existing short-flag cases).
In `@test/spectrometer_elixir_tests.erl`:
- Around line 69-73: The test is only exercising the string branch of
spectrometer_utils:is_elixir_module_name/1; add assertions in
is_elixir_module_name_case_test to also call
spectrometer_utils:is_elixir_module_name/1 with binary inputs (e.g. <<"GPIO">>
should assert true and <<"lists">> should assert false) so the new binary branch
is covered alongside the existing string assertions; keep the test name and
pattern and place the new ?assertEqual checks next to the existing calls.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d8721942-7da4-4763-af7f-f31770f87a95
📒 Files selected for processing (6)
src/atomvm_spectrometer.erlsrc/spectrometer_help.erlsrc/spectrometer_utils.erltest/atomvm_spectrometer_tests.erltest/spectrometer_elixir_tests.erltest/spectrometer_utils_tests.erl
Correctly report Elixir modules as supported when the 'Elixir' prefix is ommited. Signed-off-by: Winford <winford@object.stream>
1c36b49 to
5fdb2ab
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Correctly report Elixir modules as supported when the 'Elixir' prefix is ommited.