@@ -37,16 +37,15 @@ spec = do
3737 validate
3838 [ " binary=/hlint" ,
3939 " path=." ,
40+ " hints=.hlint.yaml" ,
4041 " category=code-quality" ,
4142 " token=AB12CD"
4243 ]
4344 `shouldBe` Nothing
4445
4546 prop " argument must have '=' character" $ \ s ->
46- ' ='
47- `notElem` s
48- ==> validate [s]
49- `shouldSatisfy` isJust
47+ ' =' `notElem` s ==>
48+ validate [s] `shouldSatisfy` isJust
5049
5150 prop " argument must not have duplicate keyword" $ \ key v v' ->
5251 ' =' `notElem` key ==> \ keyValues ->
@@ -56,23 +55,22 @@ spec = do
5655 validate args `shouldSatisfy` isJust
5756
5857 prop " argument must have explicitly allowed keyword" $ \ key v ->
59- ' ='
60- `notElem` key
61- ==> key
62- `notElem` [" binary" , " path" , " category" , " token" ]
63- ==> validate [key <> " =" <> v]
64- `shouldSatisfy` isJust
58+ ' =' `notElem` key ==>
59+ key `notElem` [" binary" , " path" , " hints" , " category" , " token" ] ==>
60+ validate [key <> " =" <> v]
61+ `shouldSatisfy` isJust
6562
6663 describe " translate" $ do
6764 it " translates specific arguments" $
6865 translate
6966 [ " binary=/hlint" ,
7067 " path=." ,
68+ " hints=.hlint.yaml" ,
7169 " category=code-quality" ,
7270 " token=XYZ123"
7371 ]
7472 `shouldBe` ( " /hlint" ,
75- [" ." , " -j" , " --sarif" , " --no-exit-code" ],
73+ [" ." , " --hint=.hlint.yaml " , " - j" , " --sarif" , " --no-exit-code" ],
7674 Just " code-quality" ,
7775 Just " XYZ123"
7876 )
@@ -88,7 +86,11 @@ spec = do
8886 `shouldSatisfy` \ (binary, _, _, _) -> binary == " /hlint"
8987
9088 prop " translates empty path to default path" $
91- translate [" binary=" ]
89+ translate [" path=" ]
90+ `shouldSatisfy` \ (_, args, _, _) -> args == [" ." , " -j" , " --sarif" , " --no-exit-code" ]
91+
92+ prop " translates empty hints to omitted hints file flag" $
93+ translate [" hints=" ]
9294 `shouldSatisfy` \ (_, args, _, _) -> args == [" ." , " -j" , " --sarif" , " --no-exit-code" ]
9395
9496 prop " translates empty category to Nothing" $
@@ -99,27 +101,21 @@ spec = do
99101 translate [" token=" ]
100102 `shouldSatisfy` \ (_, _, token, _) -> isNothing token
101103
102- prop " translates general arguments" $ \ binary path category token ->
103- binary
104- /= " "
105- && path
106- /= " "
107- && category
108- /= " "
109- && token
110- /= " "
104+ prop " translates general arguments" $ \ binary path hints category token ->
105+ binary /= " " && path /= " " && hints /= " " && category /= " " && token /= " "
111106 ==> forAll
112107 ( shuffle
113108 [ " binary=" <> binary,
114109 " path=" <> path,
110+ " hints=" <> hints,
115111 " category=" <> category,
116112 " token=" <> token
117113 ]
118114 )
119115 $ \ args ->
120116 translate args
121117 `shouldBe` ( binary,
122- [path, " -j" , " --sarif" , " --no-exit-code" ],
118+ [path, " --hint= " <> hints, " - j" , " --sarif" , " --no-exit-code" ],
123119 Just category,
124120 Just token
125121 )
0 commit comments