Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# that they are unlikely to be what you are interested in when blaming.
# Like formatting with Fantomas
# https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
# NOTE: order is oldest commits go at the top, newest ones at the bottom

# Console,Core,Tests: fix FSharpLint warning (Fixing the warning for AvoidTooShortNames rule.)
e9410e83af1de4d76230b0e8d44ae6a99fac6d7b
Expand All @@ -12,3 +13,6 @@ e9410e83af1de4d76230b0e8d44ae6a99fac6d7b

# README,Core: reviewed rules categories & their descriptions
2ab7b6ad9b5ad63f1934c1476ae5965022bb49f9

# Rename FL0094
b33fd78a73160e82cdf7c7ce9313b33d5f630a06
2 changes: 1 addition & 1 deletion docs/content/how-tos/rule-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ The following rules can be specified for linting.
- [FavourNestedFunctions (FL0091)](rules/FL0091.html)
- [DisallowShadowing (FL0092)](rules/FL0092.html)
- [DiscourageStringInterpolationWithStringFormat (FL0093)](rules/FL0093.html)
- [FavourNamesInDUMembers (FL0094)](rules/FL0094.html)
- [FavourNamedMembers (FL0094)](rules/FL0094.html)
4 changes: 2 additions & 2 deletions docs/content/how-tos/rules/FL0094.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category: how-to
hide_menu: true
---

# FavourNamesInDUMembers (FL0094)
# FavourNamedMembers (FL0094)

*Introduced in `0.26.12`*

Expand Down Expand Up @@ -48,7 +48,7 @@ Add a field name to the discriminated union case field.
## Rule Settings

{
"favourNamesInDUMembers": {
"favourNamedMembers": {
"enabled": false
}
}
10 changes: 5 additions & 5 deletions src/FSharpLint.Core/Application/Configuration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ type ConventionsConfig =
favourNestedFunctions:EnabledConfig option
disallowShadowing:EnabledConfig option
discourageStringInterpolationWithStringFormat:EnabledConfig option
favourNamesInDUMembers:EnabledConfig option }
favourNamedMembers:EnabledConfig option }
with
member this.Flatten() =
Array.concat
Expand Down Expand Up @@ -419,7 +419,7 @@ with
this.favourNestedFunctions |> Option.bind (constructRuleIfEnabled FavourNestedFunctions.rule) |> Option.toArray
this.disallowShadowing |> Option.bind (constructRuleIfEnabled DisallowShadowing.rule) |> Option.toArray
this.discourageStringInterpolationWithStringFormat |> Option.bind (constructRuleIfEnabled DiscourageStringInterpolationWithStringFormat.rule) |> Option.toArray
this.favourNamesInDUMembers |> Option.bind (constructRuleIfEnabled FavourNamesInDUMembers.rule) |> Option.toArray
this.favourNamedMembers |> Option.bind (constructRuleIfEnabled FavourNamedMembers.rule) |> Option.toArray
|]

[<Obsolete(ObsoleteMsg, ObsoleteWarnTreatAsError)>]
Expand Down Expand Up @@ -564,7 +564,7 @@ type Configuration =
FavourNestedFunctions:EnabledConfig option
DisallowShadowing:EnabledConfig option
DiscourageStringInterpolationWithStringFormat:EnabledConfig option
FavourNamesInDUMembers:EnabledConfig option }
FavourNamedMembers:EnabledConfig option }
with
// Method Zero is too big but can't be split into parts because it returns a record
// and it requires all fields to be set.
Expand Down Expand Up @@ -673,7 +673,7 @@ with
FavourNestedFunctions = None
DisallowShadowing = None
DiscourageStringInterpolationWithStringFormat = None
FavourNamesInDUMembers = None
FavourNamedMembers = None
}

// fsharplint:enable MaxLinesInMember
Expand Down Expand Up @@ -884,7 +884,7 @@ let flattenConfig (config:Configuration) =
config.FavourNestedFunctions |> Option.bind (constructRuleIfEnabled FavourNestedFunctions.rule)
config.DisallowShadowing |> Option.bind (constructRuleIfEnabled DisallowShadowing.rule)
config.DiscourageStringInterpolationWithStringFormat |> Option.bind (constructRuleIfEnabled DiscourageStringInterpolationWithStringFormat.rule)
config.FavourNamesInDUMembers |> Option.bind (constructRuleIfEnabled FavourNamesInDUMembers.rule)
config.FavourNamedMembers |> Option.bind (constructRuleIfEnabled FavourNamedMembers.rule)
|]

findDeprecation config deprecatedAllRules allRules
2 changes: 1 addition & 1 deletion src/FSharpLint.Core/FSharpLint.Core.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<Compile Include="Rules\Conventions\FavourNestedFunctions.fs" />
<Compile Include="Rules\Conventions\DisallowShadowing.fs" />
<Compile Include="Rules\Conventions\DiscourageStringInterpolationWithStringFormat.fs" />
<Compile Include="Rules\Conventions\FavourNamesInDUMembers.fs" />
<Compile Include="Rules\Conventions\FavourNamedMembers.fs" />
<Compile Include="Rules\Conventions\SourceLength\SourceLengthHelper.fs" />
<Compile Include="Rules\Conventions\SourceLength\MaxLinesInLambdaFunction.fs" />
<Compile Include="Rules\Conventions\SourceLength\MaxLinesInMatchLambdaFunction.fs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module FSharpLint.Rules.FavourNamesInDUMembers
module FSharpLint.Rules.FavourNamedMembers

open System
open FSharpLint.Framework
Expand All @@ -12,7 +12,7 @@ let runner (args: AstNodeRuleParams) =
Array.singleton
{
Range = range
Message = Resources.GetString "RulesFavourNamesInDUMembers"
Message = Resources.GetString "RulesFavourNamedMembers"
SuggestedFix = None
TypeChecks = List.Empty
}
Expand Down Expand Up @@ -45,8 +45,8 @@ let runner (args: AstNodeRuleParams) =
let rule =
AstNodeRule
{
Name = "FavourNamesInDUMembers"
Identifier = Identifiers.FavourNamesInDUMembers
Name = "FavourNamedMembers"
Identifier = Identifiers.FavourNamedMembers
RuleConfig =
{
AstNodeRuleConfig.Runner = runner
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpLint.Core/Rules/Identifiers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ let NoAsyncRunSynchronouslyInLibrary = identifier 90
let FavourNestedFunctions = identifier 91
let DisallowShadowing = identifier 92
let DiscourageStringInterpolationWithStringFormat = identifier 93
let FavourNamesInDUMembers = identifier 94
let FavourNamedMembers = identifier 94
2 changes: 1 addition & 1 deletion src/FSharpLint.Core/Text.resx
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@
<data name="RulesDiscourageStringInterpolationWithStringFormat" xml:space="preserve">
<value>Use sprintf instead of String.Format.</value>
</data>
<data name="RulesFavourNamesInDUMembers" xml:space="preserve">
<data name="RulesFavourNamedMembers" xml:space="preserve">
<value>Use named discriminated union fields.</value>
</data>
</root>
2 changes: 1 addition & 1 deletion src/FSharpLint.Core/fsharplint.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
"discourageStringInterpolationWithStringFormat": {
"enabled": false
},
"favourNamesInDUMembers": { "enabled": false },
"favourNamedMembers": { "enabled": false },
"hints": {
"add": [
"not (a = b) ===> a <> b",
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharpLint.Core.Tests/FSharpLint.Core.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<Compile Include="Rules\Conventions\FavourSingleton.fs" />
<Compile Include="Rules\Conventions\FavourNestedFunctions.fs" />
<Compile Include="Rules\Conventions\DisallowShadowing.fs" />
<Compile Include="Rules\Conventions\FavourNamesInDUMembers.fs" />
<Compile Include="Rules\Conventions\FavourNamedMembers.fs" />
<Compile Include="Rules\Conventions\Naming\NamingHelpers.fs" />
<Compile Include="Rules\Conventions\Naming\InterfaceNames.fs" />
<Compile Include="Rules\Conventions\Naming\ExceptionNames.fs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module FSharpLint.Core.Tests.Rules.Conventions.FavourNamesInDUMembers
module FSharpLint.Core.Tests.Rules.Conventions.FavourNamedMembers

open NUnit.Framework

open FSharpLint.Rules
open FSharpLint.Core.Tests

[<TestFixture>]
type TestFavourNamesInDUMembers() =
inherit TestAstNodeRuleBase.TestAstNodeRuleBase(FavourNamesInDUMembers.rule)
type TestFavourNamedMembers() =
inherit TestAstNodeRuleBase.TestAstNodeRuleBase(FavourNamedMembers.rule)

[<Test>]
member this.``Should produce error for DU with unnamed fields``() =
Expand Down