-
Notifications
You must be signed in to change notification settings - Fork 75
Add InterpolatedStringWithNoSubstitution rule #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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. |
|
Not confusing at all, both cases are string interpolation without real interpolation. Just generalize the docs. |
d62174c to
a1f7dc6
Compare
Updated the docs. I can't say I like the new warning message, but couldn't come up with anything better. |
src/FSharpLint.Core/Rules/Smells/InterpolatedStringWithNoSubstitution.fs
Outdated
Show resolved
Hide resolved
Please 0.26.8 |
9d3a2a9 to
94eb889
Compare
Changed version to 0.26.8. |
src/FSharpLint.Core/Rules/Smells/InterpolatedStringWithNoSubstitution.fs
Outdated
Show resolved
Hide resolved
tests/FSharpLint.Core.Tests/Rules/Smells/InterpolatedStringWithNoSubstitution.fs
Outdated
Show resolved
Hide resolved
tests/FSharpLint.Core.Tests/Rules/Smells/InterpolatedStringWithNoSubstitution.fs
Outdated
Show resolved
Hide resolved
c2a0f22 to
ca74de0
Compare
|
Let's squash commits properly and I'll merge. |
f74acb7 to
b06991e
Compare
tests/FSharpLint.Core.Tests/Rules/Smells/InterpolatedStringWithNoSubstitution.fs
Outdated
Show resolved
Hide resolved
tests/FSharpLint.Core.Tests/Rules/Smells/InterpolatedStringWithNoSubstitution.fs
Outdated
Show resolved
Hide resolved
b06991e to
3fb96a1
Compare
|
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.
ad0c9a0 to
c5cad2d
Compare
No, position of expected error changed slightly. Already fixed. |
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).