Skip to content

Conversation

@webwarrior-ws
Copy link
Contributor

Fixes: #542

Supersedes #589

@knocte
Copy link
Collaborator

knocte commented Jan 20, 2026

As we might change this rule in the future to use $"" strings, let's rename it to PreferStringInterpolationWithIdiomaticFSharp

Fixes: fsprojects#542

Co-authored-by: webwarrior-ws <reg@webwarrior.ws>
@knocte knocte force-pushed the FormatString-rebased branch 6 times, most recently from 53e1c73 to eb67825 Compare January 22, 2026 09:17
knocte and others added 4 commits January 22, 2026 20:19
Better to not mention "sprintf" in the rule name, in case we
change this rule in the future to recommend inline strings
(e.g. `$"foo{bar}"`).
@knocte knocte force-pushed the FormatString-rebased branch from 58b062f to a0ceba8 Compare January 22, 2026 12:20
@knocte knocte changed the title Add new rule PreferStringInterpolationWithSprintf Add new rule DiscourageStringInterpolationWithStringFormat Jan 22, 2026
Better to place it the last if it's the last added rule.
@knocte knocte force-pushed the FormatString-rebased branch from 5a660b1 to f7e8b53 Compare January 22, 2026 12:32
Make tests more self-contained and less confusing.
@knocte knocte force-pushed the FormatString-rebased branch from d424f73 to 1f274b3 Compare January 22, 2026 12:51
@knocte
Copy link
Collaborator

knocte commented Jan 22, 2026

@webwarrior-ws I know you contributed to this PR already, but imagine you hadn't: please review the whole diff before I merge.

@webwarrior-ws
Copy link
Contributor Author

Other than that, LGTM.

@knocte knocte force-pushed the FormatString-rebased branch from 1f274b3 to 27ffeda Compare January 22, 2026 13:08
@knocte knocte force-pushed the FormatString-rebased branch from 27ffeda to 44819e2 Compare January 22, 2026 13:13
@knocte
Copy link
Collaborator

knocte commented Jan 22, 2026

@webwarrior-ws actually, I have found a problem, see my last TMP commit. Let's address it with a new commit (adding a test of course).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Rule to suggest sprintf instead of String.Format

3 participants