Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Python] Fix unsafe option unwrapping in Replacements.fs#4480

Merged
dbrattli merged 4 commits into
main from
repo-assist/codescan-1521-1203-py-unsafe-option-1c8fc098f6d8fee5
Apr 3, 2026
Merged

[Python] Fix unsafe option unwrapping in Replacements.fs #4480
dbrattli merged 4 commits into
main from
repo-assist/codescan-1521-1203-py-unsafe-option-1c8fc098f6d8fee5

Conversation

@github-actions

@github-actions github-actions Bot commented Apr 3, 2026
edited by dbrattli
Loading

Copy link
Copy Markdown
Contributor

Summary

Fixes unsafe .Value accesses on thisArg: Expr option in Python Replacements.fs:

  • DateTimeOffset.get_Offset: thisArg.Value used without checking if thisArg is Some
  • Regex function: Multiple members (get_Options, get_Index, get_Value, get_Length, get_Success, get_Item, GetEnumerator) all used thisArg.Value directly
  • Refactored all match thisArg with Some -> ... |> Some | None -> None patterns to use Option.map for consistency and conciseness

All fixes follow the established pattern already used elsewhere in the file (e.g., get_Count).

Test plan

  • dotnet build passes
  • CI Python tests pass

Co-authored-by: Dag Brattli dag@brattli.net

...et_Item
Addresses code scanning alerts IONIDE-006 #1521 and #1203:
- `get_Offset`: wrap thisArg.Value access in match expression
- regex `get_Item` fallback: wrap thisArg.Value access in match expression
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added automation Automated changes repo-assist Created by Repo Assist labels Apr 3, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dbrattli dbrattli marked this pull request as ready for review April 3, 2026 07:06

github-actions Bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

Python Type Checking Results (Pyright)

Metric Value
Total errors 18
Files with errors 4
Excluded files 4
New errors ✅ No
Excluded files with errors (4 files)

These files have known type errors and are excluded from CI. Remove from pyrightconfig.ci.json as errors are fixed.

File Errors Status
temp/tests/Python/test_applicative.py 12 Excluded
temp/tests/Python/test_hash_set.py 3 Excluded
temp/tests/Python/test_nested_and_recursive_pattern.py 2 Excluded
temp/tests/Python/fable_modules/thoth_json_python/encode.py 1 Excluded

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dbrattli dbrattli changed the title (削除) [Repo Assist] [Python] Fix unsafe option unwrapping in Replacements.fs (IONIDE-006 alerts #1521, #1203) (削除ここまで) (追記) [Python] Fix unsafe option unwrapping in Replacements.fs (追記ここまで) Apr 3, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dbrattli dbrattli merged commit fc0f255 into main Apr 3, 2026
24 checks passed
@dbrattli dbrattli deleted the repo-assist/codescan-1521-1203-py-unsafe-option-1c8fc098f6d8fee5 branch April 3, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

automation Automated changes repo-assist Created by Repo Assist

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /