Исправления и добавления в СписокЗначений#1710
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesValueList behavior
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant ValueListImpl
participant TypeDescription
participant AvailableValues
participant ValueListItem
Caller->>ValueListImpl: Insert(value)
ValueListImpl->>TypeDescription: AdjustValue(value)
ValueListImpl->>AvailableValues: FindByValue(adjusted value)
ValueListImpl->>ValueListItem: create normalized item
ValueListImpl-->>Caller: updated list
Possibly related PRs
🚥 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/OneScript.StandardLibrary/Collections/ValueList/ValueListImpl.cs (1)
87-101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd defensive
nullhandling for C# callers.While the OneScript engine passes
BslUndefinedValuewhen a script sets the property toНеопределено, direct C# callers might clear the property by passingnull. The current switch throws anInvalidArgumentTypeexception fornull.Consider treating
nullidentically toBslUndefinedValue.♻️ Proposed refactor
set { switch (value) { + case null: case BslUndefinedValue: _availableValues = null; break; case ValueListImpl vl: _availableValues = vl; break; default: throw RuntimeException.InvalidArgumentType(); } }🤖 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 `@src/OneScript.StandardLibrary/Collections/ValueList/ValueListImpl.cs` around lines 87 - 101, Update the property setter containing the switch on value to handle a C# null input the same way as BslUndefinedValue: clear _availableValues and return without throwing. Preserve the existing ValueListImpl assignment and InvalidArgumentType behavior for all other values.
🤖 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/OneScript.StandardLibrary/Collections/ValueList/ValueListImpl.cs`:
- Around line 157-170: Update CreateNewListItem so
_availableValues.FindByValue(newValue) is treated as a lookup result: use the
matched ValueListItem.Value when found, and retain or reapply
ListValueType.AdjustValue for a missing result such as BslUndefinedValue. Ensure
the returned ValueListItem.Value is never another ValueListItem.
---
Nitpick comments:
In `@src/OneScript.StandardLibrary/Collections/ValueList/ValueListImpl.cs`:
- Around line 87-101: Update the property setter containing the switch on value
to handle a C# null input the same way as BslUndefinedValue: clear
_availableValues and return without throwing. Preserve the existing
ValueListImpl assignment and InvalidArgumentType behavior for all other values.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: af84cea8-c1d8-40b8-ade6-4b86459beef3
📒 Files selected for processing (4)
src/OneScript.StandardLibrary/Collections/ValueList/ValueListImpl.cssrc/OneScript.StandardLibrary/Collections/ValueList/ValueListItem.cssrc/OneScript.StandardLibrary/TypeDescriptions/TypeDescription.cstests/value-list.os
Summary by CodeRabbit
New Features
Bug Fixes
Tests