Skip to content

Commit e3aca86

Browse files
committed
don't repeat attribute args
1 parent ca78f8c commit e3aca86

File tree

5 files changed

+57
-30
lines changed

5 files changed

+57
-30
lines changed

src/Ionide.Analyzers/Suggestion/CopyAndUpdateRecordChangesAllFieldsAnalyzer.fs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,20 @@ let analyze parseTree (typedTree: FSharpImplementationFileContents option) =
5858

5959
Seq.toList messages
6060

61-
[<CliAnalyzer("CopyAndUpdateRecordChangesAllFieldsAnalyzer",
62-
"Detect if all fields in a record update expression are updated.",
63-
"https://ionide.io/ionide-analyzers/suggestion/001.html")>]
61+
[<Literal>]
62+
let name = "CopyAndUpdateRecordChangesAllFieldsAnalyzer"
63+
64+
[<Literal>]
65+
let shortDescription =
66+
"Detect if all fields in a record update expression are updated."
67+
68+
[<Literal>]
69+
let helpUri = "https://ionide.io/ionide-analyzers/suggestion/001.html"
70+
71+
[<CliAnalyzer(name, shortDescription, helpUri)>]
6472
let copyAndUpdateRecordChangesAllFieldsCliAnalyzer: Analyzer<CliContext> =
6573
fun (context: CliContext) -> async { return analyze context.ParseFileResults.ParseTree context.TypedTree }
6674

67-
[<EditorAnalyzer("CopyAndUpdateRecordChangesAllFieldsAnalyzer",
68-
"Detect if all fields in a record update expression are updated.",
69-
"https://ionide.io/ionide-analyzers/suggestion/001.html")>]
75+
[<EditorAnalyzer(name, shortDescription, helpUri)>]
7076
let copyAndUpdateRecordChangesAllFieldsEditorAnalyzer: Analyzer<EditorContext> =
7177
fun (context: EditorContext) -> async { return analyze context.ParseFileResults.ParseTree context.TypedTree }

src/Ionide.Analyzers/Suggestion/EmptyStringAnalyzer.fs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,19 @@ let analyze (typedTree: FSharpImplementationFileContents) =
4141
)
4242
|> Seq.toList
4343

44-
[<EditorAnalyzer("EmptyStringAnalyzer",
45-
"Verifies testing for an empty string is done efficiently.",
46-
"https://ionide.io/ionide-analyzers/suggestion/005.html")>]
44+
[<Literal>]
45+
let name = "EmptyStringAnalyzer"
46+
47+
[<Literal>]
48+
let shortDescription = "Verifies testing for an empty string is done efficiently."
49+
50+
[<Literal>]
51+
let helpUri = "https://ionide.io/ionide-analyzers/suggestion/005.html"
52+
53+
[<EditorAnalyzer(name, shortDescription, helpUri)>]
4754
let emptyStringEditorAnalyzer (ctx: EditorContext) =
4855
async { return ctx.TypedTree |> Option.map analyze |> Option.defaultValue [] }
4956

50-
[<CliAnalyzer("EmptyStringAnalyzer",
51-
"Verifies testing for an empty string is done efficiently.",
52-
"https://ionide.io/ionide-analyzers/suggestion/005.html")>]
57+
[<CliAnalyzer(name, shortDescription, helpUri)>]
5358
let emptyStringCliAnalyzer (ctx: CliContext) =
5459
async { return ctx.TypedTree |> Option.map analyze |> Option.defaultValue [] }

src/Ionide.Analyzers/Suggestion/HandleOptionGracefullyAnalyzer.fs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,18 @@ let analyze (typedTree: FSharpImplementationFileContents option) =
4545
walkTast walker typedTree
4646
Seq.toList messages
4747

48-
[<CliAnalyzer("HandleOptionGracefullyAnalyzer",
49-
"Replace unsafe option unwrapping with graceful handling of each case.",
50-
"https://ionide.io/ionide-analyzers/suggestion/006.html")>]
48+
[<Literal>]
49+
let name = "HandleOptionGracefullyAnalyzer"
50+
51+
[<Literal>]
52+
let shortDescription =
53+
"Replace unsafe option unwrapping with graceful handling of each case."
54+
55+
[<Literal>]
56+
let helpUri = "https://ionide.io/ionide-analyzers/suggestion/006.html"
57+
58+
[<CliAnalyzer(name, shortDescription, helpUri)>]
5159
let optionGetCliAnalyzer (ctx: CliContext) = async { return analyze ctx.TypedTree }
5260

53-
[<EditorAnalyzer("HandleOptionGracefullyAnalyzer",
54-
"Replace unsafe option unwrapping with graceful handling of each case.",
55-
"https://ionide.io/ionide-analyzers/suggestion/006.html")>]
61+
[<EditorAnalyzer(name, shortDescription, helpUri)>]
5662
let optionGetEditorAnalyzer (ctx: EditorContext) = async { return analyze ctx.TypedTree }

src/Ionide.Analyzers/Suggestion/IgnoreFunctionAnalyzer.fs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ let analyzer (typedTree: FSharpImplementationFileContents option) =
3333
walkTast tastCollector typedTree
3434
Seq.toList messages
3535

36-
[<CliAnalyzer("IgnoreFunctionAnalyzer",
37-
"A function is being ignored. Did you mean to execute this?",
38-
"https://ionide.io/ionide-analyzers/suggestion/003.html")>]
36+
[<Literal>]
37+
let name = "IgnoreFunctionAnalyzer"
38+
39+
[<Literal>]
40+
let shortDescription = "A function is being ignored. Did you mean to execute this?"
41+
42+
[<Literal>]
43+
let helpUri = "https://ionide.io/ionide-analyzers/suggestion/003.html"
44+
45+
[<CliAnalyzer(name, shortDescription, helpUri)>]
3946
let ignoreFunctionCliAnalyzer (ctx: CliContext) = async { return analyzer ctx.TypedTree }
4047

41-
[<EditorAnalyzer("IgnoreFunctionAnalyzer",
42-
"A function is being ignored. Did you mean to execute this?",
43-
"https://ionide.io/ionide-analyzers/suggestion/003.html")>]
48+
[<EditorAnalyzer(name, shortDescription, helpUri)>]
4449
let ignoreFunctionEditorAnalyzer (ctx: EditorContext) = async { return analyzer ctx.TypedTree }

src/Ionide.Analyzers/Suggestion/UnnamedDiscriminatedUnionFieldAnalyzer.fs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,19 @@ let analyze parseTree =
3737

3838
Seq.toList messages
3939

40-
[<CliAnalyzer("UnnamedDiscriminatedUnionFieldAnalyzer",
41-
"Verifies each field in a union case is named.",
42-
"https://ionide.io/ionide-analyzers/suggestion/004.html")>]
40+
[<Literal>]
41+
let name = "UnnamedDiscriminatedUnionFieldAnalyzer"
42+
43+
[<Literal>]
44+
let shortDescription = "Verifies each field in a union case is named."
45+
46+
[<Literal>]
47+
let helpUri = "https://ionide.io/ionide-analyzers/suggestion/004.html"
48+
49+
[<CliAnalyzer(name, shortDescription, helpUri)>]
4350
let unnamedDiscriminatedUnionFieldCliAnalyzer (ctx: CliContext) =
4451
async { return analyze ctx.ParseFileResults.ParseTree }
4552

46-
[<EditorAnalyzer("UnnamedDiscriminatedUnionFieldAnalyzer",
47-
"Verifies each field in a union case is named.",
48-
"https://ionide.io/ionide-analyzers/suggestion/004.html")>]
53+
[<EditorAnalyzer(name, shortDescription, helpUri)>]
4954
let unnamedDiscriminatedUnionFieldEditorAnalyzer (ctx: EditorContext) =
5055
async { return analyze ctx.ParseFileResults.ParseTree }

0 commit comments

Comments
 (0)