Skip to content

Commit 396c4b5

Browse files
github-actions[bot]claudedbrattli
authored
[Repo Assist] Fix code scanning alerts: interpolated string format specifiers and unsafe option access (#4421)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Dag Brattli <dag@brattli.net>
1 parent f0210a7 commit 396c4b5

5 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/Fable.Cli/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111

12+
* [All] Fix interpolated string holes missing format specifiers in State.fs and Python/Replacements.fs (code scanning alerts 1144, 1145, 1512)
13+
* [Rust] Replace unsafe `.IsSome && .Value` option pattern with `Option.exists` in Fable2Rust.fs (code scanning alert 1125)
1214
* [JS/TS] Fix `Unchecked.defaultof<char>` being emitted as `null` instead of `'\0'` (by @MangelMaxime)
1315
* [JS/TS] Fix `static val mutable` fields declared with `[<DefaultValue>]` not being zero-initialized (fix #2739) (by @MangelMaxime)
1416
* [JS/TS/Python] Fix record/struct types augmented with `static let` or `static member val` generating extra constructor parameters for each static field, causing constructor arguments to be assigned to wrong slots (by @MangelMaxime)

src/Fable.Compiler/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111

12+
* [All] Fix interpolated string holes missing format specifiers in State.fs and Python/Replacements.fs (code scanning alerts 1144, 1145, 1512)
13+
* [Rust] Replace unsafe `.IsSome && .Value` option pattern with `Option.exists` in Fable2Rust.fs (code scanning alert 1125)
1214
* [JS/TS] Fix `Unchecked.defaultof<char>` being emitted as `null` instead of `'\0'` (by @MangelMaxime)
1315
* [JS/TS] Fix `static val mutable` fields declared with `[<DefaultValue>]` not being zero-initialized (fix #2739) (by @MangelMaxime)
1416
* [JS/TS/Python] Fix record/struct types augmented with `static let` or `static member val` generating extra constructor parameters for each static field, causing constructor arguments to be assigned to wrong slots (by @MangelMaxime)

src/Fable.Transforms/Python/Replacements.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2497,7 +2497,7 @@ let intrinsicFunctions (com: ICompiler) (ctx: Context) r t (i: CallInfo) (thisAr
24972497

24982498
Helper.ConstructorCall(constructor com ent, t, [], ?loc = r) |> Some
24992499
| t ->
2500-
$"Cannot create instance of type unresolved at compile time: {t}"
2500+
$"Cannot create instance of type unresolved at compile time: %A{t}"
25012501
|> addErrorAndReturnNull com ctx.InlinePath r
25022502
|> Some
25032503
// reference: https://msdn.microsoft.com/visualfsharpdocs/conceptual/operatorintrinsics.powdouble-function-%5bfsharp%5d

src/Fable.Transforms/Rust/Fable2Rust.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ module Util =
16411641
expr
16421642
elif isInRefType com typ then
16431643
expr
1644-
elif nameOpt.IsSome && isRefScoped ctx nameOpt.Value then
1644+
elif nameOpt |> Option.exists (isRefScoped ctx) then
16451645
expr
16461646
elif shouldBeRefCountWrapped com ctx typ |> Option.isSome then
16471647
expr |> makeAsRef

src/Fable.Transforms/State.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type Assemblies(getPlugin, fsharpAssemblies: FSharpAssembly list, addLog: Severi
4747
// but keep the process going to mimic previous Fable behavior
4848
// and because these exception seems harmless
4949
let errorMessage =
50-
$"Could not scan {path} for Fable plugins, skipping this assembly. Original error: {error.Message}"
50+
$"Could not scan %s{path} for Fable plugins, skipping this assembly. Original error: %s{error.Message}"
5151

5252
addLog Severity.Info errorMessage
5353

0 commit comments

Comments
 (0)