File tree Expand file tree Collapse file tree 2 files changed +55
-3
lines changed
samples/OptionAnalyzer.Test Expand file tree Collapse file tree 2 files changed +55
-3
lines changed Original file line number Diff line number Diff line change @@ -273,4 +273,56 @@ let x = 1
273273 let ctx = getContext projectOptions source
274274 ctx.AnalyzerIgnoreRanges |> tryCompareRanges " IONIDE-001" [ SingleLine 3 ]
275275 ctx.AnalyzerIgnoreRanges |> tryCompareRanges " IONIDE-002" [ SingleLine 3 ]
276+ }
277+
278+ [<Test>]
279+ let ``file ignore handles tight spacing`` () =
280+ async {
281+ let source = """
282+ module M
283+ // IGNORE FILE:IONIDE-001
284+ let x = 1
285+ """
286+ let ctx = getContext projectOptions source
287+ ctx.AnalyzerIgnoreRanges |> tryCompareRanges " IONIDE-001" [ File]
288+ }
289+
290+ [<Test>]
291+ let ``file ignore handles loose spacing`` () =
292+ async {
293+ let source = """
294+ module M
295+ // IGNORE FILE : IONIDE-001
296+ let x = 1
297+ """
298+ let ctx = getContext projectOptions source
299+ ctx.AnalyzerIgnoreRanges |> tryCompareRanges " IONIDE-001" [ File]
300+ }
301+
302+
303+
304+ [<Test>]
305+ let ``range ignore handles tight spacing`` () =
306+ async {
307+ let source = """
308+ module M
309+ // IGNORE START:IONIDE-001
310+ let x = 1
311+ // IGNORE END
312+ """
313+ let ctx = getContext projectOptions source
314+ ctx.AnalyzerIgnoreRanges |> tryCompareRanges " IONIDE-001" [ Range ( 3 , 5 )]
315+ }
316+
317+ [<Test>]
318+ let ``range ignore handles loose spacing`` () =
319+ async {
320+ let source = """
321+ module M
322+ // IGNORE START : IONIDE-001
323+ let x = 1
324+ // IGNORE END
325+ """
326+ let ctx = getContext projectOptions source
327+ ctx.AnalyzerIgnoreRanges |> tryCompareRanges " IONIDE-001" [ Range ( 3 , 5 )]
276328 }
Original file line number Diff line number Diff line change @@ -57,11 +57,11 @@ module Ignore =
5757 match sourceText.GetLineString( r.StartLine - 1 ) with
5858 | ParseRegexCompiled @" IGNORE\s*:\s*(.*)$" [ SplitBy splitBy codes ] ->
5959 Some <| IgnoreComment.SingleLine( r.StartLine, trimCodes codes)
60- | ParseRegexCompiled @" IGNORE FILE\s*:\s*(.*)$" [ SplitBy splitBy codes ] ->
60+ | ParseRegexCompiled @" IGNORE\s+ FILE\s*:\s*(.*)$" [ SplitBy splitBy codes ] ->
6161 Some <| IgnoreComment.File ( trimCodes codes)
62- | ParseRegexCompiled @" IGNORE START\s*:\s*(.*)$" [ SplitBy splitBy codes ] ->
62+ | ParseRegexCompiled @" IGNORE\s+ START\s*:\s*(.*)$" [ SplitBy splitBy codes ] ->
6363 Some <| IgnoreComment.RangeStart( r.StartLine, trimCodes codes)
64- | ParseRegexCompiled @" IGNORE END(.*)$" _ -> Some <| IgnoreComment.RangeEnd r.StartLine
64+ | ParseRegexCompiled @" IGNORE\s+ END(.*)$" _ -> Some <| IgnoreComment.RangeEnd r.StartLine
6565 | _ -> None
6666
6767 let getIgnoreComments ( sourceText : ISourceText ) ( comments : CommentTrivia list ) =
You can’t perform that action at this time.
0 commit comments