ShellCheck.CFGAnalysis

ShellCheck-0.11.0: Shell script analysis tool

Safe Haskell | None
Language | Haskell98

ShellCheck.CFGAnalysis

# Documentation

analyzeControlFlow :: CFGParameters -> Token -> CFGAnalysis #

data CFGParameters #

Constructors

CFGParameters |
Fields cfLastpipe :: Bool cfPipefail :: Bool

data CFGAnalysis #

Constructors

CFGAnalysis |
Fields graph :: CFGraph tokenToRange :: Map Id (Node, Node) tokenToNodes :: Map Id (Set Node) postDominators :: Array Node [Node] nodeToData :: Map Node (ProgramState, ProgramState)

#### Instances

Instances details

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

data ProgramState #

Constructors

ProgramState |
Fields variablesInScope :: Map String VariableState exitCodes :: Set Id stateIsReachable :: Bool

#### Instances

Instances details

NFData ProgramState # |
Instance details Defined in ShellCheck.CFGAnalysis Methods rnf :: ProgramState -> () #
Generic ProgramState # |
Instance details Defined in ShellCheck.CFGAnalysis Associated Types
type Rep ProgramState |
Instance details Defined in ShellCheck.CFGAnalysis type Rep ProgramState = D1 ('MetaData "ProgramState" "ShellCheck.CFGAnalysis" "ShellCheck-0.11.0-1xTbc6KP8FIExqK1aN5cEO" 'False) (C1 ('MetaCons "ProgramState" 'PrefixI 'True) (S1 ('MetaSel ('Just "variablesInScope") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map String VariableState)) :*: (S1 ('MetaSel ('Just "exitCodes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set Id)) :*: S1 ('MetaSel ('Just "stateIsReachable") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))
Methods from :: ProgramState -> Rep ProgramState x # to :: Rep ProgramState x -> ProgramState #
Show ProgramState # |
Instance details Defined in ShellCheck.CFGAnalysis Methods showsPrec :: Int -> ProgramState -> ShowS # show :: ProgramState -> String # showList :: [ProgramState] -> ShowS #
Eq ProgramState # |
Instance details Defined in ShellCheck.CFGAnalysis Methods (==) :: ProgramState -> ProgramState -> Bool # (/=) :: ProgramState -> ProgramState -> Bool #
type Rep ProgramState # |
Instance details Defined in ShellCheck.CFGAnalysis type Rep ProgramState = D1 ('MetaData "ProgramState" "ShellCheck.CFGAnalysis" "ShellCheck-0.11.0-1xTbc6KP8FIExqK1aN5cEO" 'False) (C1 ('MetaCons "ProgramState" 'PrefixI 'True) (S1 ('MetaSel ('Just "variablesInScope") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map String VariableState)) :*: (S1 ('MetaSel ('Just "exitCodes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set Id)) :*: S1 ('MetaSel ('Just "stateIsReachable") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))

data VariableState #

Constructors

VariableState |
Fields variableValue :: VariableValue variableProperties :: VariableProperties

#### Instances

Instances details

NFData VariableState # |
Instance details Defined in ShellCheck.CFGAnalysis Methods rnf :: VariableState -> () #
Generic VariableState # |
Instance details Defined in ShellCheck.CFGAnalysis Associated Types
type Rep VariableState |
Instance details Defined in ShellCheck.CFGAnalysis type Rep VariableState = D1 ('MetaData "VariableState" "ShellCheck.CFGAnalysis" "ShellCheck-0.11.0-1xTbc6KP8FIExqK1aN5cEO" 'False) (C1 ('MetaCons "VariableState" 'PrefixI 'True) (S1 ('MetaSel ('Just "variableValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VariableValue) :*: S1 ('MetaSel ('Just "variableProperties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VariableProperties)))
Methods from :: VariableState -> Rep VariableState x # to :: Rep VariableState x -> VariableState #
Show VariableState # |
Instance details Defined in ShellCheck.CFGAnalysis Methods showsPrec :: Int -> VariableState -> ShowS # show :: VariableState -> String # showList :: [VariableState] -> ShowS #
Eq VariableState # |
Instance details Defined in ShellCheck.CFGAnalysis Methods (==) :: VariableState -> VariableState -> Bool # (/=) :: VariableState -> VariableState -> Bool #
Ord VariableState # |
Instance details Defined in ShellCheck.CFGAnalysis Methods compare :: VariableState -> VariableState -> Ordering # (<) :: VariableState -> VariableState -> Bool # (<=) :: VariableState -> VariableState -> Bool # (>) :: VariableState -> VariableState -> Bool # (>=) :: VariableState -> VariableState -> Bool # max :: VariableState -> VariableState -> VariableState # min :: VariableState -> VariableState -> VariableState #
type Rep VariableState # |
Instance details Defined in ShellCheck.CFGAnalysis type Rep VariableState = D1 ('MetaData "VariableState" "ShellCheck.CFGAnalysis" "ShellCheck-0.11.0-1xTbc6KP8FIExqK1aN5cEO" 'False) (C1 ('MetaCons "VariableState" 'PrefixI 'True) (S1 ('MetaSel ('Just "variableValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VariableValue) :*: S1 ('MetaSel ('Just "variableProperties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VariableProperties)))

data VariableValue #

Constructors

VariableValue |
Fields literalValue :: Maybe String spaceStatus :: SpaceStatus numericalStatus :: NumericalStatus

#### Instances

Instances details

NFData VariableValue # |
Instance details Defined in ShellCheck.CFGAnalysis Methods rnf :: VariableValue -> () #
Generic VariableValue # |
Instance details Defined in ShellCheck.CFGAnalysis Associated Types
type Rep VariableValue |
Instance details Defined in ShellCheck.CFGAnalysis type Rep VariableValue = D1 ('MetaData "VariableValue" "ShellCheck.CFGAnalysis" "ShellCheck-0.11.0-1xTbc6KP8FIExqK1aN5cEO" 'False) (C1 ('MetaCons "VariableValue" 'PrefixI 'True) (S1 ('MetaSel ('Just "literalValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: (S1 ('MetaSel ('Just "spaceStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SpaceStatus) :*: S1 ('MetaSel ('Just "numericalStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NumericalStatus))))
Methods from :: VariableValue -> Rep VariableValue x # to :: Rep VariableValue x -> VariableValue #
Show VariableValue # |
Instance details Defined in ShellCheck.CFGAnalysis Methods showsPrec :: Int -> VariableValue -> ShowS # show :: VariableValue -> String # showList :: [VariableValue] -> ShowS #
Eq VariableValue # |
Instance details Defined in ShellCheck.CFGAnalysis Methods (==) :: VariableValue -> VariableValue -> Bool # (/=) :: VariableValue -> VariableValue -> Bool #
Ord VariableValue # |
Instance details Defined in ShellCheck.CFGAnalysis Methods compare :: VariableValue -> VariableValue -> Ordering # (<) :: VariableValue -> VariableValue -> Bool # (<=) :: VariableValue -> VariableValue -> Bool # (>) :: VariableValue -> VariableValue -> Bool # (>=) :: VariableValue -> VariableValue -> Bool # max :: VariableValue -> VariableValue -> VariableValue # min :: VariableValue -> VariableValue -> VariableValue #
type Rep VariableValue # |
Instance details Defined in ShellCheck.CFGAnalysis type Rep VariableValue = D1 ('MetaData "VariableValue" "ShellCheck.CFGAnalysis" "ShellCheck-0.11.0-1xTbc6KP8FIExqK1aN5cEO" 'False) (C1 ('MetaCons "VariableValue" 'PrefixI 'True) (S1 ('MetaSel ('Just "literalValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: (S1 ('MetaSel ('Just "spaceStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SpaceStatus) :*: S1 ('MetaSel ('Just "numericalStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NumericalStatus))))

type VariableProperties = Set (Set CFVariableProp) #

data SpaceStatus #

Constructors

SpaceStatusEmpty |
SpaceStatusClean |
SpaceStatusDirty |

#### Instances

Instances details

NFData SpaceStatus # |
Instance details Defined in ShellCheck.CFGAnalysis Methods rnf :: SpaceStatus -> () #
Generic SpaceStatus # |
Instance details Defined in ShellCheck.CFGAnalysis Associated Types
type Rep SpaceStatus |
Instance details Defined in ShellCheck.CFGAnalysis type Rep SpaceStatus = D1 ('MetaData "SpaceStatus" "ShellCheck.CFGAnalysis" "ShellCheck-0.11.0-1xTbc6KP8FIExqK1aN5cEO" 'False) (C1 ('MetaCons "SpaceStatusEmpty" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SpaceStatusClean" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SpaceStatusDirty" 'PrefixI 'False) (U1 :: Type -> Type)))
Methods from :: SpaceStatus -> Rep SpaceStatus x # to :: Rep SpaceStatus x -> SpaceStatus #
Show SpaceStatus # |
Instance details Defined in ShellCheck.CFGAnalysis Methods showsPrec :: Int -> SpaceStatus -> ShowS # show :: SpaceStatus -> String # showList :: [SpaceStatus] -> ShowS #
Eq SpaceStatus # |
Instance details Defined in ShellCheck.CFGAnalysis Methods (==) :: SpaceStatus -> SpaceStatus -> Bool # (/=) :: SpaceStatus -> SpaceStatus -> Bool #
Ord SpaceStatus # |
Instance details Defined in ShellCheck.CFGAnalysis Methods compare :: SpaceStatus -> SpaceStatus -> Ordering # (<) :: SpaceStatus -> SpaceStatus -> Bool # (<=) :: SpaceStatus -> SpaceStatus -> Bool # (>) :: SpaceStatus -> SpaceStatus -> Bool # (>=) :: SpaceStatus -> SpaceStatus -> Bool # max :: SpaceStatus -> SpaceStatus -> SpaceStatus # min :: SpaceStatus -> SpaceStatus -> SpaceStatus #
type Rep SpaceStatus # |
Instance details Defined in ShellCheck.CFGAnalysis type Rep SpaceStatus = D1 ('MetaData "SpaceStatus" "ShellCheck.CFGAnalysis" "ShellCheck-0.11.0-1xTbc6KP8FIExqK1aN5cEO" 'False) (C1 ('MetaCons "SpaceStatusEmpty" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SpaceStatusClean" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SpaceStatusDirty" 'PrefixI 'False) (U1 :: Type -> Type)))

data NumericalStatus #

Constructors

NumericalStatusUnknown |
NumericalStatusEmpty |
NumericalStatusMaybe |
NumericalStatusDefinitely |

#### Instances

Instances details

NFData NumericalStatus # |
Instance details Defined in ShellCheck.CFGAnalysis Methods rnf :: NumericalStatus -> () #
Generic NumericalStatus # |
Instance details Defined in ShellCheck.CFGAnalysis Associated Types
type Rep NumericalStatus |
Instance details Defined in ShellCheck.CFGAnalysis type Rep NumericalStatus = D1 ('MetaData "NumericalStatus" "ShellCheck.CFGAnalysis" "ShellCheck-0.11.0-1xTbc6KP8FIExqK1aN5cEO" 'False) ((C1 ('MetaCons "NumericalStatusUnknown" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NumericalStatusEmpty" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NumericalStatusMaybe" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NumericalStatusDefinitely" 'PrefixI 'False) (U1 :: Type -> Type)))
Methods from :: NumericalStatus -> Rep NumericalStatus x # to :: Rep NumericalStatus x -> NumericalStatus #
Show NumericalStatus # |
Instance details Defined in ShellCheck.CFGAnalysis Methods showsPrec :: Int -> NumericalStatus -> ShowS # show :: NumericalStatus -> String # showList :: [NumericalStatus] -> ShowS #
Eq NumericalStatus # |
Instance details Defined in ShellCheck.CFGAnalysis Methods (==) :: NumericalStatus -> NumericalStatus -> Bool # (/=) :: NumericalStatus -> NumericalStatus -> Bool #
Ord NumericalStatus # |
Instance details Defined in ShellCheck.CFGAnalysis Methods compare :: NumericalStatus -> NumericalStatus -> Ordering # (<) :: NumericalStatus -> NumericalStatus -> Bool # (<=) :: NumericalStatus -> NumericalStatus -> Bool # (>) :: NumericalStatus -> NumericalStatus -> Bool # (>=) :: NumericalStatus -> NumericalStatus -> Bool # max :: NumericalStatus -> NumericalStatus -> NumericalStatus # min :: NumericalStatus -> NumericalStatus -> NumericalStatus #
type Rep NumericalStatus # |
Instance details Defined in ShellCheck.CFGAnalysis type Rep NumericalStatus = D1 ('MetaData "NumericalStatus" "ShellCheck.CFGAnalysis" "ShellCheck-0.11.0-1xTbc6KP8FIExqK1aN5cEO" 'False) ((C1 ('MetaCons "NumericalStatusUnknown" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NumericalStatusEmpty" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NumericalStatusMaybe" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NumericalStatusDefinitely" 'PrefixI 'False) (U1 :: Type -> Type)))

getIncomingState :: CFGAnalysis -> Id -> Maybe ProgramState #

getOutgoingState :: CFGAnalysis -> Id -> Maybe ProgramState #

doesPostDominate :: CFGAnalysis -> Id -> Id -> Bool #

variableMayBeDeclaredInteger :: ProgramState -> String -> Maybe Bool #

variableMayBeAssignedInteger :: ProgramState -> String -> Maybe Bool #

runTests :: IO Bool #