File tree Expand file tree Collapse file tree
tests/FSharpLint.Console.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "sdk" : {
3- "version" : " 3.1.200 "
3+ "version" : " 3.1.301 "
44 }
55}
Original file line number Diff line number Diff line change @@ -95,3 +95,35 @@ type TestConsoleApplication() =
9595
9696 Assert.AreEqual( 0 , returnCode)
9797 Assert.AreEqual( Set.empty, errors)
98+
99+ /// Regression test for: https://github.com/fsprojects/FSharpLint/issues/466
100+ /// Hints listed in the ignore section of the config were not being ignored.
101+ [<Test>]
102+ member __. ``Ignoring a hint in the configuration should stop it from being output as warning.`` () =
103+ let input = """
104+ let x = [1; 2; 3; 4] |> List.map (fun x -> x + 2) |> List.map (fun x -> x + 2)
105+ """
106+
107+ let ( returnCode , errors ) = main [| " lint" ; input |]
108+
109+ // Check default config triggers the hint we're expecting to ignore later.
110+ Assert.AreEqual(- 1 , returnCode)
111+ Assert.AreEqual( Set.ofList [
112+ " `List.map f (List.map g x)` might be able to be refactored into `List.map (g >> f) x`." ], errors)
113+
114+ let config = """
115+ {
116+ "hints": {
117+ "add": [],
118+ "ignore": [
119+ "List.map f (List.map g x) ===> List.map (g >> f) x"
120+ ]
121+ }
122+ }
123+ """
124+ use config = new TemporaryFile( config, " json" )
125+
126+ let ( returnCode , errors ) = main [| " lint" ; " --lint-config" ; config.FileName; input |]
127+
128+ Assert.AreEqual( 0 , returnCode)
129+ Assert.AreEqual( Set.empty, errors)
You can’t perform that action at this time.
0 commit comments