File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -4236,16 +4236,22 @@ checkSecondArgIsComparison _ t =
4236
4236
case argString of
4237
4237
' =' : ' =' : ' =' : ' =' : _ -> Nothing -- Don't warn about `echo ======` and such
4238
4238
' +' : ' =' : _ ->
4239
- return $ err (getId t) 2285 $
4239
+ return $ err (headId t) 2285 $
4240
4240
" Remove spaces around += to assign (or quote '+=' if literal)."
4241
4241
' =' : ' =' : _ ->
4242
4242
return $ err (getId t) 2284 $
4243
4243
" Use [ x = y ] to compare values (or quote '==' if literal)."
4244
4244
' =' : _ ->
4245
- return $ err (getId t ) 2283 $
4246
- " Use [ ] to compare values, or remove spaces around = to assign ( or quote '=' if literal)."
4245
+ return $ err (headId arg ) 2283 $
4246
+ " Remove spaces around = to assign ( or use [ ] to compare, or quote '=' if literal)."
4247
4247
_ -> Nothing
4248
4248
_ -> return ()
4249
+ where
4250
+ -- We don't pinpoint exactly, but this helps cases like foo =$bar
4251
+ headId t =
4252
+ case t of
4253
+ T_NormalWord _ (x: _) -> getId x
4254
+ _ -> getId t
4249
4255
4250
4256
return []
4251
4257
runTests = $ ( [| $ (forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) | ])
You can’t perform that action at this time.
0 commit comments