[Repo Assist] Fix code scanning alerts: interpolated string format specifiers and unsafe option access#4421
Merged
dbrattli merged 2 commits intoMar 19, 2026
Conversation
…nsafe option unwrapping - Add %s/%A format specifiers to interpolated strings in State.fs and Python/Replacements.fs (resolves alerts 1144, 1145, 1512) - Replace `.IsSome && .Value` option pattern with `Option.exists` in Rust/Fable2Rust.fs for `makeRefForPatternMatch` (resolves alert 1125) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7 tasks
…afety-a5757dfd33fbd98d
dbrattli
approved these changes
Mar 19, 2026
Contributor
Author
Python Type Checking Results (Pyright)
Excluded files with errors (4 files)These files have known type errors and are excluded from CI. Remove from
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Fixes four open code scanning alerts reported by the Ionide analyzer:
Alert 1144/1145 (
State.fsline 50): Added%sformat specifiers to interpolated string holes forpathanderror.Message. Without explicit format specifiers, the F# interpolated string produces an untypedstringconversion; adding%smakes the intent and types explicit.Alert 1512 (
Python/Replacements.fsline 2500): Added%Aformat specifier for aFable.Typediscriminated union value in an error message.%Ais the correct specifier for arbitrary F# values.Alert 1125 (
Rust/Fable2Rust.fsline 1644): Replaced the.IsSome && .Valuepattern — which the analyzer flags as unsafe option unwrapping — withOption.exists, which is both idiomatic and avoids the potential for aNone.Valueexception if the guard condition were ever refactored.Changes
src/Fable.Transforms/State.fs%sprefix on{path}and{error.Message}src/Fable.Transforms/Python/Replacements.fs%Aprefix on{t}(Fable.Type value)src/Fable.Transforms/Rust/Fable2Rust.fsnameOpt.IsSome && isRefScoped ctx nameOpt.Value→nameOpt |> Option.exists (isRefScoped ctx)Test plan
Option.existsis semantically equivalent to.IsSome && .ValuewhenIsSomeis true)🤖 Generated with [Claude Code]((claude.com/redacted)