[All] Fix ~45 code scanning warnings in Fable.Transforms#4357
Open
[All] Fix ~45 code scanning warnings in Fable.Transforms#4357
Conversation
Address five categories of analyzer warnings across 23 files: - GRA-STRING-001/002/004: Add StringComparison.Ordinal to string operations - IONIDE-007: Replace cons-nil patterns (x :: []) with list literals ([x]) - IONIDE-005: Replace empty string comparisons with String.IsNullOrEmpty - GRA-TYPE-ANNOTATE-001: Add type annotations to ambiguous `string` calls - GRA-INTERPOLATED-001: Add format specifiers (:s, :d) to interpolated strings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Ionide.Analyzers.Cli found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Python Type Checking Results (Pyright)
Excluded files with errors (4 files)These files have known type errors and are excluded from CI. Remove from
|
…tations Revert all :s and :d format specifiers added to interpolated strings because Fable's Standalone tests compile the compiler to JavaScript, and Fable doesn't handle .NET-style format specifiers correctly — they produce literal % characters in the JS output. Also fix string type annotations to use string<type> syntax instead of string (x: type), which the analyzer still flagged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| Helper.ConstructorCall(constructor com ent, t, [], ?loc = r) |> Some | ||
| | t -> | ||
| $"Cannot create instance of type unresolved at compile time: %A{t}" | ||
| $"Cannot create instance of type unresolved at compile time: {t}" |
Check warning
Code scanning / Ionide.Analyzers.Cli
Warns about missing type specifiers in interpolated strings Warning
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.
Summary
src/Fable.Transforms/StringComparison.OrdinaltoStartsWith,EndsWith, andLastIndexOfstring overloadsx :: []) with list literal patterns ([x]), also improving readability of complex multi-element patterns inRust/Replacements.fss = ""conditionals withString.IsNullOrEmpty(s)for more efficient empty string testingstringfunction calls usingstring<type>syntaxNote: GRA-INTERPOLATED-001 (
:s/:dformat specifiers) was attempted but reverted — the Standalone tests compile the compiler to JavaScript via Fable, which doesn't handle .NET-style format specifiers correctly.Test plan
dotnet build src/Fable.Transforms/Fable.Transforms.fsproj— 0 errors, 0 warnings./build.sh test javascript --skip-fable-library— 2,603/2,607 passed (4 failures are pre-existing locale-dependent Convert format tests)🤖 Generated with Claude Code