Skip to content

Conversation

@webwarrior-ws
Copy link
Contributor

Added InterpolatedStringWithNoSubstitution rule that checks for usage of interpolated strings (with $ prefix, such as $"foo") without embedded F# expression (e.g. $"{foo}" where foo is some value).

@knocte
Copy link
Collaborator

knocte commented Nov 18, 2025

Let's also flag sprintfs where there is no % element.

@webwarrior-ws
Copy link
Contributor Author

Let's also flag sprintfs where there is no % element.

Mention both cases in docs and warning message? This might turn out to be confusing.

@knocte
Copy link
Collaborator

knocte commented Nov 18, 2025

Not confusing at all, both cases are string interpolation without real interpolation. Just generalize the docs.

@webwarrior-ws webwarrior-ws force-pushed the interpolated-strings branch 2 times, most recently from d62174c to a1f7dc6 Compare November 19, 2025 09:25
@webwarrior-ws
Copy link
Contributor Author

Not confusing at all, both cases are string interpolation without real interpolation. Just generalize the docs.

Updated the docs. I can't say I like the new warning message, but couldn't come up with anything better.

@knocte
Copy link
Collaborator

knocte commented Nov 19, 2025

Introduced in 0.26.7

Please 0.26.8

@webwarrior-ws
Copy link
Contributor Author

Introduced in 0.26.7

Please 0.26.8

Changed version to 0.26.8.

@webwarrior-ws webwarrior-ws force-pushed the interpolated-strings branch 2 times, most recently from c2a0f22 to ca74de0 Compare November 20, 2025 08:50
@knocte
Copy link
Collaborator

knocte commented Nov 20, 2025

Let's squash commits properly and I'll merge.

@webwarrior-ws webwarrior-ws force-pushed the interpolated-strings branch 2 times, most recently from f74acb7 to b06991e Compare November 20, 2025 09:08
@knocte
Copy link
Collaborator

knocte commented Nov 20, 2025

Tests failed, maybe the rule was expecting pipe only?

Created tests for InterpolatedStringWithNoSubstitution rule.
Contains failing tests.
Implemented InterpolatedStringWithNoSubstitution rule.
Added docs and configuration for
InterpolatedStringWithNoSubstitution rule. Enabled this rule
by default.
Use regular string instead of interpolated string because there
are no embedded expressions in that string.

Use `failwith` instead of `failwithf` where there is no string
substitution.
@webwarrior-ws
Copy link
Contributor Author

Tests failed, maybe the rule was expecting pipe only?

No, position of expected error changed slightly. Already fixed.

@knocte knocte merged commit 57a1193 into fsprojects:master Nov 20, 2025
7 checks passed
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.

2 participants