mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-13 16:43:20 -07:00
Merge branch 'iss1724-builtin-support' of https://github.com/jabberabbe/shellcheck into jabberabbe-iss1724-builtin-support
This commit is contained in:
commit
cbcca528ae
5 changed files with 20 additions and 3 deletions
|
@ -122,12 +122,16 @@ buildCommandMap = foldl' addCheck Map.empty
|
|||
|
||||
|
||||
checkCommand :: Map.Map CommandName (Token -> Analysis) -> Token -> Analysis
|
||||
checkCommand map t@(T_SimpleCommand id _ (cmd:rest)) = fromMaybe (return ()) $ do
|
||||
checkCommand map t@(T_SimpleCommand id cmdPrefix (cmd:rest)) = fromMaybe (return ()) $ do
|
||||
name <- getLiteralString cmd
|
||||
return $
|
||||
if '/' `elem` name
|
||||
then
|
||||
Map.findWithDefault nullCheck (Basename $ basename name) map t
|
||||
else if name == "builtin" && not (null rest) then
|
||||
let t' = T_SimpleCommand id cmdPrefix rest
|
||||
selectedBuiltin = fromMaybe "" $ getLiteralString . head $ rest
|
||||
in Map.findWithDefault nullCheck (Exactly selectedBuiltin) map t'
|
||||
else do
|
||||
Map.findWithDefault nullCheck (Exactly name) map t
|
||||
Map.findWithDefault nullCheck (Basename name) map t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue