ShellCheck-0.4.7: Shell script analysis tool

Safe Haskell | None
Language | Haskell98

ShellCheck.AnalyzerLib

# Documentation

type Analysis = AnalyzerM () #

type AnalyzerM a = RWS Parameters [TokenComment] Cache a #

nullCheck :: b -> RWST Parameters [TokenComment] Cache Identity () #

data Checker #

Constructors

Checker |

Fields

- perScript :: Root -> Analysis
- perToken :: Token -> Analysis

Instances

Semigroup Checker # |
Instance details Defined in ShellCheck.AnalyzerLib Methods (<>) :: Checker -> Checker -> Checker # sconcat :: NonEmpty Checker -> Checker # stimes :: Integral b => b -> Checker -> Checker #
Monoid Checker # |
Instance details Defined in ShellCheck.AnalyzerLib Methods mempty :: Checker # mappend :: Checker -> Checker -> Checker # mconcat :: [Checker] -> Checker #

runChecker :: Parameters -> Checker -> [TokenComment] #

composeAnalyzers :: (a -> Analysis) -> (a -> Analysis) -> a -> Analysis #

data Parameters #

Constructors

Parameters |

Fields

- hasLastpipe :: Bool
- hasSetE :: Bool
- variableFlow :: [StackData]
- parentMap :: Map Id Token
- shellType :: Shell
- shellTypeSpecified :: Bool
- rootNode :: Token

data Cache #

Constructors

Cache |

data Scope #

Constructors

SubshellScope String |
NoneScope |

Instances

Eq Scope # |
Instance details Defined in ShellCheck.AnalyzerLib Methods (==) :: Scope -> Scope -> Bool # (/=) :: Scope -> Scope -> Bool #
Show Scope # |
Instance details Defined in ShellCheck.AnalyzerLib Methods showsPrec :: Int -> Scope -> ShowS # show :: Scope -> String # showList :: [Scope] -> ShowS #

data StackData #

Constructors

StackScope Scope |
StackScopeEnd |
Assignment (Token, Token, String, DataType) |
Reference (Token, Token, String) |

Instances

Show StackData # |
Instance details Defined in ShellCheck.AnalyzerLib Methods showsPrec :: Int -> StackData -> ShowS # show :: StackData -> String # showList :: [StackData] -> ShowS #

data DataType #

Constructors

DataString DataSource |
DataArray DataSource |

Instances

Show DataType # |
Instance details Defined in ShellCheck.AnalyzerLib Methods showsPrec :: Int -> DataType -> ShowS # show :: DataType -> String # showList :: [DataType] -> ShowS #

data DataSource #

Constructors

SourceFrom [Token] |
SourceExternal |
SourceDeclaration |
SourceInteger |
SourceChecked |

Instances

Show DataSource # |
Instance details Defined in ShellCheck.AnalyzerLib Methods showsPrec :: Int -> DataSource -> ShowS # show :: DataSource -> String # showList :: [DataSource] -> ShowS #

data VariableState #

Constructors

Dead Token String |
Alive |

Instances

Show VariableState # |
Instance details Defined in ShellCheck.AnalyzerLib Methods showsPrec :: Int -> VariableState -> ShowS # show :: VariableState -> String # showList :: [VariableState] -> ShowS #

defaultSpec :: Token -> AnalysisSpec #

pScript :: [Char] -> Maybe Token #

producesComments :: Checker -> String -> Maybe Bool #

makeComment :: Severity -> Id -> Code -> String -> TokenComment #

addComment :: MonadWriter [a] m => a -> m () #

warn :: MonadWriter [TokenComment] m => Id -> Code -> String -> m () #

err :: MonadWriter [TokenComment] m => Id -> Code -> String -> m () #

info :: MonadWriter [TokenComment] m => Id -> Code -> String -> m () #

style :: MonadWriter [TokenComment] m => Id -> Code -> String -> m () #

makeParameters :: AnalysisSpec -> Parameters #

containsSetE :: Token -> Bool #

containsLastpipe :: Token -> Bool #

prop_determineShell0 :: Bool #

prop_determineShell1 :: Bool #

prop_determineShell2 :: Bool #

prop_determineShell3 :: Bool #

prop_determineShell4 :: Bool #

prop_determineShell5 :: Bool #

prop_determineShell6 :: Bool #

prop_determineShell7 :: Bool #

determineShell :: Token -> Shell #

executableFromShebang :: String -> String #

getParentTree :: Token -> Map Id Token #

getTokenMap :: Token -> Map Id Token #

isStrictlyQuoteFree :: Map Id Token -> Token -> Bool #

isQuoteFree :: Map Id Token -> Token -> Bool #

isQuoteFreeNode :: Bool -> Map Id Token -> Token -> Bool #

isParamTo :: Map Id Token -> String -> Token -> Bool #

getClosestCommand :: Map Id Token -> Token -> Maybe Token #

getClosestCommandM :: MonadReader Parameters m => Token -> m (Maybe Token) #

usedAsCommandName :: Map Id Token -> Token -> Bool #

getPath :: Map Id Token -> Token -> [Token] #

getPathM :: MonadReader Parameters m => Token -> m [Token] #

isParentOf :: Map Id Token -> Token -> Token -> Bool #

parents :: Parameters -> Token -> [Token] #

pathTo :: MonadReader Parameters m => Token -> m [Token] #

findFirst :: (a -> Maybe Bool) -> [a] -> Maybe a #

tokenIsJustCommandOutput :: Token -> Bool #

getVariableFlow :: Parameters -> Token -> [StackData] #

leadType :: Parameters -> Token -> Scope #

getModifiedVariables :: Token -> [(Token, Token, String, DataType)] #

isClosingFileOp :: Token -> Bool #

getReferencedVariableCommand :: Token -> [(Token, Token, String)] #

getModifiedVariableCommand :: Token -> [(Token, Token, [Char], DataType)] #

getIndexReferences :: String -> [String] #

getOffsetReferences :: String -> [String] #

getReferencedVariables :: Map Id Token -> Token -> [(Token, Token, [Char])] #

dataTypeFrom :: (DataSource -> DataType) -> Token -> DataType #

isCommand :: Token -> String -> Bool #

isUnqualifiedCommand :: Token -> String -> Bool #

isCommandMatch :: Token -> (String -> Bool) -> Bool #

isConfusedGlobRegex :: String -> Bool #

isVariableStartChar :: Char -> Bool #

isVariableChar :: Char -> Bool #

variableNameRegex :: Regex #

prop_isVariableName1 :: Bool #

prop_isVariableName2 :: Bool #

prop_isVariableName3 :: Bool #

isVariableName :: [Char] -> Bool #

getVariablesFromLiteralToken :: Token -> [String] #

prop_getVariablesFromLiteral1 :: Bool #

getVariablesFromLiteral :: String -> [String] #

prop_getBracedReference1 :: Bool #

prop_getBracedReference2 :: Bool #

prop_getBracedReference3 :: Bool #

prop_getBracedReference4 :: Bool #

prop_getBracedReference5 :: Bool #

prop_getBracedReference6 :: Bool #

prop_getBracedReference7 :: Bool #

prop_getBracedReference8 :: Bool #

prop_getBracedReference9 :: Bool #

prop_getBracedReference10 :: Bool #

prop_getBracedReference11 :: Bool #

prop_getBracedReference12 :: Bool #

prop_getBracedReference13 :: Bool #

getBracedReference :: [Char] -> [Char] #

prop_getBracedModifier1 :: Bool #

prop_getBracedModifier2 :: Bool #

prop_getBracedModifier3 :: Bool #

getBracedModifier :: [Char] -> [Char] #

potentially :: Monad m => Maybe (m ()) -> m () #

headOrDefault :: p -> [p] -> p #

(!!!) :: [a] -> Int -> Maybe a #

whenShell :: (MonadReader Parameters m, Foldable t) => t Shell -> m () -> m () #

filterByAnnotation :: AnalysisSpec -> Parameters -> [TokenComment] -> [TokenComment] #

isCountingReference :: Token -> Bool #

isQuotedAlternativeReference :: Token -> Bool #

runTests :: IO Bool #