Skip to content

Commit 64277b4

Browse files
committed
Rename FL0093
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}"`).
1 parent f6a7ccd commit 64277b4

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

docs/content/how-tos/rule-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ The following rules can be specified for linting.
133133
- [NoAsyncRunSynchronouslyInLibrary (FL0090)](rules/FL0090.html)
134134
- [FavourNestedFunctions (FL0091)](rules/FL0091.html)
135135
- [DisallowShadowing (FL0092)](rules/FL0092.html)
136-
- [PreferStringInterpolationWithSprintf (FL0093)](rules/FL0093.html)
136+
- [DiscourageStringInterpolationWithStringFormat (FL0093)](rules/FL0093.html)

docs/content/how-tos/rules/FL0093.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ category: how-to
44
hide_menu: true
55
---
66

7-
# PreferStringInterpolationWithSprintf (FL0091)
7+
# DiscourageStringInterpolationWithStringFormat (FL0091)
88

99
*Introduced in `0.26.12`*
1010

@@ -23,7 +23,7 @@ Use sprintf instead of String.Format.
2323
## Rule Settings
2424

2525
{
26-
"preferStringInterpolationWithSprintf": {
26+
"discourageStringInterpolationWithStringFormat": {
2727
"enabled": false
2828
}
2929
}

src/FSharpLint.Core/Application/Configuration.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ type ConventionsConfig =
387387
ensureTailCallDiagnosticsInRecursiveFunctions:EnabledConfig option
388388
favourNestedFunctions:EnabledConfig option
389389
disallowShadowing:EnabledConfig option
390-
preferStringInterpolationWithSprintf:EnabledConfig option}
390+
discourageStringInterpolationWithStringFormat:EnabledConfig option}
391391
with
392392
member this.Flatten() =
393393
Array.concat
@@ -417,7 +417,7 @@ with
417417
this.indexerAccessorStyleConsistency |> Option.bind (constructRuleWithConfig IndexerAccessorStyleConsistency.rule) |> Option.toArray
418418
this.favourNestedFunctions |> Option.bind (constructRuleIfEnabled FavourNestedFunctions.rule) |> Option.toArray
419419
this.disallowShadowing |> Option.bind (constructRuleIfEnabled DisallowShadowing.rule) |> Option.toArray
420-
this.preferStringInterpolationWithSprintf |> Option.bind (constructRuleIfEnabled PreferStringInterpolationWithSprintf.rule) |> Option.toArray
420+
this.discourageStringInterpolationWithStringFormat |> Option.bind (constructRuleIfEnabled DiscourageStringInterpolationWithStringFormat.rule) |> Option.toArray
421421
|]
422422

423423
[<Obsolete(ObsoleteMsg, ObsoleteWarnTreatAsError)>]
@@ -561,7 +561,7 @@ type Configuration =
561561
NoAsyncRunSynchronouslyInLibrary:EnabledConfig option
562562
FavourNestedFunctions:EnabledConfig option
563563
DisallowShadowing:EnabledConfig option
564-
PreferStringInterpolationWithSprintf:EnabledConfig option }
564+
DiscourageStringInterpolationWithStringFormat:EnabledConfig option }
565565
with
566566
static member Zero = {
567567
Global = None
@@ -590,7 +590,7 @@ with
590590
RecursiveAsyncFunction = None
591591
AvoidTooShortNames = None
592592
IndexerAccessorStyleConsistency = None
593-
PreferStringInterpolationWithSprintf = None
593+
DiscourageStringInterpolationWithStringFormat = None
594594
RedundantNewKeyword = None
595595
FavourNonMutablePropertyInitialization = None
596596
FavourReRaise = None

src/FSharpLint.Core/FSharpLint.Core.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<Compile Include="Rules\Conventions\FavourSingleton.fs" />
6363
<Compile Include="Rules\Conventions\FavourNestedFunctions.fs" />
6464
<Compile Include="Rules\Conventions\DisallowShadowing.fs" />
65-
<Compile Include="Rules\Conventions\PreferStringInterpolationWithSprintf.fs" />
65+
<Compile Include="Rules\Conventions\DiscourageStringInterpolationWithStringFormat.fs" />
6666
<Compile Include="Rules\Conventions\SourceLength\SourceLengthHelper.fs" />
6767
<Compile Include="Rules\Conventions\SourceLength\MaxLinesInLambdaFunction.fs" />
6868
<Compile Include="Rules\Conventions\SourceLength\MaxLinesInMatchLambdaFunction.fs" />

src/FSharpLint.Core/Rules/Conventions/PreferStringInterpolationWithSprintf.fs renamed to src/FSharpLint.Core/Rules/Conventions/DiscourageStringInterpolationWithStringFormat.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module FSharpLint.Rules.PreferStringInterpolationWithSprintf
1+
module FSharpLint.Rules.DiscourageStringInterpolationWithStringFormat
22

33
open System
44
open FSharpLint.Framework
@@ -13,7 +13,7 @@ let runner args =
1313

1414
let emitViolation range =
1515
{ Range = range
16-
Message = Resources.GetString "RulesPreferStringInterpolationWithSprintf"
16+
Message = Resources.GetString "RulesDiscourageStringInterpolationWithStringFormat"
1717
SuggestedFix = None
1818
TypeChecks = List.empty }
1919
|> Array.singleton
@@ -51,7 +51,7 @@ let runner args =
5151
| _ -> Array.empty
5252

5353
let rule =
54-
{ Name = "PreferStringInterpolationWithSprintf"
55-
Identifier = Identifiers.PreferStringInterpolationWithSprintf
54+
{ Name = "DiscourageStringInterpolationWithStringFormat"
55+
Identifier = Identifiers.DiscourageStringInterpolationWithStringFormat
5656
RuleConfig = { AstNodeRuleConfig.Runner = runner; Cleanup = ignore } }
5757
|> AstNodeRule

src/FSharpLint.Core/Rules/Identifiers.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,4 @@ let FavourSingleton = identifier 89
9797
let NoAsyncRunSynchronouslyInLibrary = identifier 90
9898
let FavourNestedFunctions = identifier 91
9999
let DisallowShadowing = identifier 92
100-
let PreferStringInterpolationWithSprintf = identifier 93
100+
let DiscourageStringInterpolationWithStringFormat = identifier 93

src/FSharpLint.Core/Text.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@
402402
<data name="RulesDisallowShadowing" xml:space="preserve">
403403
<value>Rename variable or parameter so that it doesn't shadow another one with the same name.</value>
404404
</data>
405-
<data name="RulesPreferStringInterpolationWithSprintf" xml:space="preserve">
405+
<data name="RulesDiscourageStringInterpolationWithStringFormat" xml:space="preserve">
406406
<value>Use sprintf instead of String.Format.</value>
407407
</data>
408408
</root>

src/FSharpLint.Core/fsharplint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@
302302
"indentation": {
303303
"enabled": false
304304
},
305-
"preferStringInterpolationWithSprintf": {
305+
"discourageStringInterpolationWithStringFormat": {
306306
"enabled": false
307307
},
308308
"maxCharactersOnLine": {

tests/FSharpLint.Core.Tests/FSharpLint.Core.Tests.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<Compile Include="Rules\Conventions\SourceLength.fs" />
4242
<Compile Include="Rules\Conventions\NoPartialFunctions.fs" />
4343
<Compile Include="Rules\Conventions\FavourReRaise.fs" />
44-
<Compile Include="Rules\Conventions\PreferStringInterpolationWithSprintf.fs" />
44+
<Compile Include="Rules\Conventions\DiscourageStringInterpolationWithStringFormat.fs" />
4545
<Compile Include="Rules\Conventions\FavourConsistentThis.fs" />
4646
<Compile Include="Rules\Conventions\AvoidTooShortNames.fs" />
4747
<Compile Include="Rules\Conventions\AvoidSinglePipeOperator.fs" />

tests/FSharpLint.Core.Tests/Rules/Conventions/PreferStringInterpolationWithSprintf.fs renamed to tests/FSharpLint.Core.Tests/Rules/Conventions/DiscourageStringInterpolationWithStringFormat.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
module FSharpLint.Core.Tests.Rules.Conventions.PreferStringInterpolationWithSprintf
1+
module FSharpLint.Core.Tests.Rules.Conventions.DiscourageStringInterpolationWithStringFormat
22

33
open NUnit.Framework
44
open FSharpLint.Rules
55
open FSharpLint.Core.Tests
66

77
[<TestFixture>]
8-
type TestConventionsPreferStringInterpolationWithSprintf() =
9-
inherit TestAstNodeRuleBase.TestAstNodeRuleBase(PreferStringInterpolationWithSprintf.rule)
8+
type TestConventionsDiscourageStringInterpolationWithStringFormat() =
9+
inherit TestAstNodeRuleBase.TestAstNodeRuleBase(DiscourageStringInterpolationWithStringFormat.rule)
1010

1111
[<Test>]
1212
member this.StringInterpolationWithSprintfShouldNotProduceError() =

0 commit comments

Comments
 (0)