ShellCheck.AnalyzerLib

ShellCheck-0.11.0: 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

Instances details

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

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

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

data Parameters #

Constructors

Parameters |
Fields hasLastpipe :: Bool hasInheritErrexit :: Bool hasSetE :: Bool hasPipefail :: Bool hasExecfail :: Bool variableFlow :: [StackData] idMap :: Map Id Token parentMap :: Map Id Token shellType :: Shell shellTypeSpecified :: Bool rootNode :: Token tokenPositions :: Map Id (Position, Position) cfgAnalysis :: Maybe CFGAnalysis

#### Instances

Instances details

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

data Cache #

Constructors

Cache |

data Scope #

Constructors

SubshellScope String |
NoneScope |

#### Instances

Instances details

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

data StackData #

Constructors

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

#### Instances

Instances details

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

Instances details

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

Instances details

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

Instances details

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

defaultSpec :: ParseResult -> AnalysisSpec #

pScript :: String -> ParseResult #

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

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

addComment :: (NFData a, 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 () #

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

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

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

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

addCommentWithFix :: MonadWriter [TokenComment] m => Severity -> Id -> Code -> String -> Fix -> m () #

makeCommentWithFix :: Severity -> Id -> Code -> String -> Fix -> TokenComment #

makeParameters :: AnalysisSpec -> Parameters #

containsSetE :: Token -> Bool #

containsSetOption :: [Char] -> Token -> Bool #

containsShopt :: [Char] -> Token -> Bool #

isOptionSet :: [Char] -> 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 #

prop_determineShell8 :: Bool #

prop_determineShell9 :: Bool #

prop_determineShell10 :: Bool #

prop_determineShell11 :: Bool #

prop_determineShell12 :: Bool #

determineShellTest :: String -> Shell #

determineShellTest' :: Maybe Shell -> String -> Shell #

determineShell :: Maybe Shell -> Token -> Shell #

getParentTree :: Token -> Map Id Token #

getTokenMap :: Token -> Map Id Token #

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

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

isQuoteFreeNode :: Bool -> Shell -> 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 #

getPathM :: MonadReader Parameters m => Token -> m (NonEmpty Token) #

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

parents :: Parameters -> Token -> NonEmpty 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)] #

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

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

getVariableForTestDashV :: Token -> Maybe String #

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

isDereferencingBinaryOp :: String -> Bool #

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

isCommand :: Token -> String -> Bool #

isUnqualifiedCommand :: Token -> String -> Bool #

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

isConfusedGlobRegex :: String -> Bool #

getVariablesFromLiteralToken :: Token -> [String] #

prop_getVariablesFromLiteral1 :: Bool #

getVariablesFromLiteral :: String -> [String] #

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

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

shouldIgnoreCode :: Parameters -> Integer -> Token -> Bool #

isCountingReference :: Token -> Bool #

isQuotedAlternativeReference :: Token -> Bool #

supportsArrays :: Shell -> Bool #

isTrueAssignmentSource :: DataType -> Bool #

modifiesVariable :: Parameters -> Token -> String -> Bool #

isTestCommand :: Token -> Bool #

runTests :: IO Bool #