-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell STatic ANalyser -- -- Stan is a Haskell STatic ANalysis CLI tool. See -- README.md for more details. @package stan @version 0.0.0.0 -- | Category — a type of Inspection. module Stan.Category -- | A type of the inspection. newtype Category Category :: Text -> Category [unCategory] :: Category -> Text -- | Show Category in a human-friendly format. prettyShowCategory :: Category -> Text -- | The list of all available Stan Categorys. stanCategories :: [Category] -- | AntiPattern category of Stan inspections. antiPattern :: Category -- | Infinite category of Stan inspections. infinite :: Category -- | List category of Stan inspections. list :: Category -- | Partial category of Stan inspections. partial :: Category -- | SpaceLeak category of Stan inspections. spaceLeak :: Category -- | Syntax category of Stan inspections. Usually used in -- Style inspections. syntax :: Category -- | Unsafe category of Stan inspections. unsafe :: Category instance Data.Hashable.Class.Hashable Stan.Category.Category instance GHC.Classes.Eq Stan.Category.Category instance GHC.Show.Show Stan.Category.Category -- | Safe Id representation. module Stan.Core.Id -- | A wrapper around the textual value to safely represent IDs for -- different structures by using a phantom parameter. newtype Id a Id :: Text -> Id a [unId] :: Id a -> Text -- | A type alias for the situations when we don't care about the parameter -- of Id but don't want to deal with type variables. type AnyId = Id () -- | Unsafe cast of Id. Implementation uses smart trick to enforce -- usage always with TypeApplications. castId :: forall to from to'. (to == to') ~ 'True => Id from -> Id to' instance Data.Hashable.Class.Hashable (Stan.Core.Id.Id a) instance GHC.Classes.Ord (Stan.Core.Id.Id a) instance GHC.Classes.Eq (Stan.Core.Id.Id a) instance GHC.Show.Show (Stan.Core.Id.Id a) -- | Extra functions to work with lists. module Stan.Core.List -- | Checks that two lists have the same length and that a given binary -- predicate returns True on each corresponding pair of elements. -- --
--   >>> checkWith (==) [] []
--   True
--   
--   >>> checkWith (==) [1, 2] [1, 2]
--   True
--   
--   >>> checkWith (==) [1, 2] [2, 1]
--   False
--   
--   >>> checkWith (==) [1, 2] [1]
--   False
--   
checkWith :: (a -> b -> Bool) -> [a] -> [b] -> Bool -- | Returns list all element pairs without the following properties: -- -- -- -- In other words, it's like taking the cross product of the list with -- itself and then keeping only the half of that without the diagonal. -- --
--   >>> foo [1..3]
--   [(1, 2), (1, 3), (2, 3)]
--   
nonRepeatingPairs :: [a] -> [(a, a)] -- | Environment variables for stan. module Stan.EnvVars newtype EnvVars EnvVars :: TaggedTrial Text Bool -> EnvVars [envVarsUseDefaultConfigFile] :: EnvVars -> TaggedTrial Text Bool getEnvVars :: IO EnvVars envVarsToText :: EnvVars -> Text -- | Module that contains code that should trigger various beautiful Stan -- inspections :) module Stan.Example -- | Compatibility module for GHC types and functions. Reexports all -- required API to work with the GHC API. module Stan.Ghc.Compat -- | A Module is a pair of a UnitId and a ModuleName. -- -- Module variables (i.e. H) which can be instantiated to -- a specific module at some later point in time are represented with -- moduleUnitId set to holeUnitId (this allows us to avoid -- having to make moduleUnitId a partial operation.) data Module -- | A ModuleName is essentially a simple string, e.g. Data.List. data ModuleName moduleNameString :: ModuleName -> String moduleName :: Module -> ModuleName -- | Get a string representation of a Module that's unique and -- stable across recompilations. eg. -- "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal" moduleStableString :: Module -> String moduleUnitId :: Module -> UnitId -- | A unique, unambiguous name for something, containing information about -- where that thing originated. data Name isExternalName :: Name -> Bool -- | Test if the OccName is that for any operator (whether it is a -- data constructor or variable or whatever) isSymOcc :: OccName -> Bool nameModule :: HasDebugCallStack => Name -> Module nameOccName :: Name -> OccName -- | Get a string representation of a Name that's unique and stable -- across recompilations. Used for deterministic generation of binds for -- derived instances. eg. -- "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal$String" nameStableString :: Name -> String occNameString :: OccName -> String -- | A RealSrcSpan delimits a portion of a text file. It could be -- represented by a pair of (line,column) coordinates, but in fact we -- optimise slightly by using more compact representations for -- single-line and zero-length spans, both of which are quite common. -- -- The end position is defined to be the column after the end of -- the span. That is, a span of (1,1)-(1,2) is one character long, and a -- span of (1,1)-(1,1) is zero characters long. -- -- Real Source Span data RealSrcSpan srcSpanEndCol :: RealSrcSpan -> Int srcSpanStartCol :: RealSrcSpan -> Int srcSpanStartLine :: RealSrcSpan -> Int srcSpanEndLine :: RealSrcSpan -> Int srcSpanFile :: RealSrcSpan -> FastString -- | Argument Flag -- -- Is something required to appear in source Haskell (Required), -- permitted by request (Specified) (visible type application), or -- prohibited entirely from appearing in source Haskell -- (Inferred)? See Note [VarBndrs, TyCoVarBinders, TyConBinders, -- and visibility] in TyCoRep data ArgFlag Inferred :: ArgFlag Specified :: ArgFlag Required :: ArgFlag -- | Records what things are "available", i.e. in scope data AvailInfo -- | An ordinary identifier in scope Avail :: Name -> AvailInfo -- | A type or class in scope -- -- The AvailTC Invariant: If the type or class is itself to be in -- scope, it must be first in this list. Thus, typically: -- --
--   AvailTC Eq [Eq, ==, \/=] []
--   
AvailTC :: Name -> [Name] -> [FieldLabel] -> AvailInfo -- | A FastString is an array of bytes, hashed to support fast O(1) -- comparison. It is also associated with a character encoding, so that -- we know how to convert a FastString to the local encoding, or -- to the Z-encoding used by the compiler internally. -- -- FastStrings support a memoized conversion to the Z-encoding via -- zEncodeFS. data FastString -- | Fields in an algebraic record type data FieldLbl a FieldLabel :: FieldLabelString -> Bool -> a -> FieldLbl a -- | User-visible label of the field [flLabel] :: FieldLbl a -> FieldLabelString -- | Was DuplicateRecordFields on in the defining module for this datatype? [flIsOverloaded] :: FieldLbl a -> Bool -- | Record selector function [flSelector] :: FieldLbl a -> a data IfaceTyCon IfaceTyCon :: IfExtName -> IfaceTyConInfo -> IfaceTyCon [ifaceTyConName] :: IfaceTyCon -> IfExtName [ifaceTyConInfo] :: IfaceTyCon -> IfaceTyConInfo data IfaceTyConInfo IfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo [ifaceTyConIsPromoted] :: IfaceTyConInfo -> PromotionFlag [ifaceTyConSort] :: IfaceTyConInfo -> IfaceTyConSort -- | The various types of TyCons which have special, built-in syntax. data IfaceTyConSort -- | a regular tycon IfaceNormalTyCon :: IfaceTyConSort -- | e.g. (a, b, c) or (). The arity is the tuple width, -- not the tycon arity (which is twice the width in the case of unboxed -- tuples). IfaceTupleTyCon :: !Arity -> !TupleSort -> IfaceTyConSort -- | e.g. (a | b | c) IfaceSumTyCon :: !Arity -> IfaceTyConSort -- | A heterogeneous equality TyCon (i.e. eqPrimTyCon, eqReprPrimTyCon, -- heqTyCon) that is actually being applied to two types of the same -- kind. This affects pretty-printing only: see Note [Equality predicates -- in IfaceType] IfaceEqualityTyCon :: IfaceTyConSort data IfaceTyLit IfaceNumTyLit :: Integer -> IfaceTyLit IfaceStrTyLit :: FastString -> IfaceTyLit -- | Is a TyCon a promoted data constructor or just a normal type -- constructor? data PromotionFlag NotPromoted :: PromotionFlag IsPromoted :: PromotionFlag data TupleSort BoxedTuple :: TupleSort UnboxedTuple :: TupleSort ConstraintTuple :: TupleSort -- | Wrapper around Haskell module names and conversion functions for GHC -- types. module Stan.Core.ModuleName -- | Wrapper around Haskell module name. newtype ModuleName ModuleName :: Text -> ModuleName [unModuleName] :: ModuleName -> Text -- | Extract ModuleName from Module. fromGhcModule :: Module -> ModuleName -- | Convert ModuleName to ModuleName. fromGhcModuleName :: ModuleName -> ModuleName instance Data.String.IsString Stan.Core.ModuleName.ModuleName instance Data.Hashable.Class.Hashable Stan.Core.ModuleName.ModuleName instance GHC.Classes.Eq Stan.Core.ModuleName.ModuleName instance GHC.Show.Show Stan.Core.ModuleName.ModuleName -- | Compatibility module for HIE types from GHC API. Reexports all -- required API to work with HIE types. module Stan.Hie.Compat -- | Different contexts under which identifiers exist data ContextInfo -- | regular variable Use :: ContextInfo MatchBind :: ContextInfo -- | import/export IEThing :: IEType -> ContextInfo TyDecl :: ContextInfo -- | Value binding ValBind :: BindType -> Scope -> Maybe Span -> ContextInfo -- | Pattern binding -- -- This case is tricky because the bound identifier can be used in two -- distinct scopes. Consider the following example (with -- -XViewPatterns) -- --
--   do (b, a, (a -> True)) <- bar
--      foo a
--   
-- -- The identifier a has two scopes: in the view pattern (a -- -> True) and in the rest of the do-block in foo -- a. PatternBind :: Scope -> Scope -> Maybe Span -> ContextInfo ClassTyDecl :: Maybe Span -> ContextInfo -- | Declaration Decl :: DeclType -> Maybe Span -> ContextInfo -- | Type variable TyVarBind :: Scope -> TyVarScope -> ContextInfo -- | Record field RecField :: RecFieldContext -> Maybe Span -> ContextInfo -- | A list of type arguments along with their respective visibilities (ie. -- is this an argument that would return True for -- isVisibleArgFlag?). newtype HieArgs a HieArgs :: [(Bool, a)] -> HieArgs a data HieAST a Node :: NodeInfo a -> Span -> [HieAST a] -> HieAST a [nodeInfo] :: HieAST a -> NodeInfo a [nodeSpan] :: HieAST a -> Span [nodeChildren] :: HieAST a -> [HieAST a] -- | Mapping from filepaths (represented using FastString) to the -- corresponding AST newtype HieASTs a HieASTs :: Map FastString (HieAST a) -> HieASTs a [getAsts] :: HieASTs a -> Map FastString (HieAST a) -- | GHC builds up a wealth of information about Haskell source as it -- compiles it. .hie files are a way of persisting some of this -- information to disk so that external tools that need to work with -- haskell source don't need to parse, typecheck, and rename all over -- again. These files contain: -- -- -- -- Besides saving compilation cycles, .hie files also offer a -- more stable interface than the GHC API. data HieFile HieFile :: FilePath -> Module -> Array TypeIndex HieTypeFlat -> HieASTs TypeIndex -> [AvailInfo] -> ByteString -> HieFile -- | Initial Haskell source file path [hie_hs_file] :: HieFile -> FilePath -- | The module this HIE file is for [hie_module] :: HieFile -> Module -- | Types referenced in the hie_asts. -- -- See Note [Efficient serialization of redundant type info] [hie_types] :: HieFile -> Array TypeIndex HieTypeFlat -- | Type-annotated abstract syntax trees [hie_asts] :: HieFile -> HieASTs TypeIndex -- | The names that this module exports [hie_exports] :: HieFile -> [AvailInfo] -- | Raw bytes of the initial Haskell source [hie_hs_src] :: HieFile -> ByteString -- | A flattened version of Type. -- -- See Note [Efficient serialization of redundant type info] data HieType a HTyVarTy :: Name -> HieType a HAppTy :: a -> HieArgs a -> HieType a HTyConApp :: IfaceTyCon -> HieArgs a -> HieType a HForAllTy :: ((Name, a), ArgFlag) -> a -> HieType a HFunTy :: a -> a -> HieType a -- | type with constraint: t1 => t2 (see IfaceDFunTy) HQualTy :: a -> a -> HieType a HLitTy :: IfaceTyLit -> HieType a HCastTy :: a -> HieType a HCoercionTy :: HieType a type HieTypeFlat = HieType TypeIndex -- | Types of imports and exports data IEType Import :: IEType ImportAs :: IEType ImportHiding :: IEType Export :: IEType type Identifier = Either ModuleName Name -- | Information associated with every identifier -- -- We need to include types with identifiers because sometimes multiple -- identifiers occur in the same span(Overloaded Record Fields and so on) data IdentifierDetails a IdentifierDetails :: Maybe a -> Set ContextInfo -> IdentifierDetails a [identType] :: IdentifierDetails a -> Maybe a [identInfo] :: IdentifierDetails a -> Set ContextInfo -- | The information stored in one AST node. -- -- The type parameter exists to provide flexibility in representation of -- types (see Note [Efficient serialization of redundant type info]). data NodeInfo a NodeInfo :: Set (FastString, FastString) -> [a] -> NodeIdentifiers a -> NodeInfo a -- | (name of the AST node constructor, name of the AST node Type) [nodeAnnotations] :: NodeInfo a -> Set (FastString, FastString) -- | The Haskell types of this node, if any. [nodeType] :: NodeInfo a -> [a] -- | All the identifiers and their details [nodeIdentifiers] :: NodeInfo a -> NodeIdentifiers a type TypeIndex = Int data HieFileResult -- | Read a HieFile from a FilePath. Can use an existing -- NameCache. readHieFile :: NameCache -> FilePath -> IO (HieFileResult, NameCache) -- | The NameCache makes sure that there is just one Unique assigned for -- each original name; i.e. (module-name, occ-name) pair and provides -- something of a lookup mechanism for those names. data NameCache -- | Return a function to atomically update the name cache. initNameCache :: UniqSupply -> [Name] -> NameCache -- | Create a unique supply out of thin air. The character given must be -- distinct from those of all calls to this function in the compiler for -- the values generated to be truly unique. mkSplitUniqSupply :: Char -> IO UniqSupply -- | Functions to work with cabal files and cabal extension maps. module Stan.Cabal -- | From a given path to cabal files and HieFiles create the map -- from modules (that are in .cabal file) to the resulting parsed -- extensions for each. createCabalExtensionsMap :: [FilePath] -> [HieFile] -> IO (Map FilePath (Either ExtensionsError ParsedExtensions)) -- | Gets the list of .cabal file paths that were used in the -- project. usedCabalFiles :: [FilePath] -> IO [FilePath] mergeParsedExtensions :: Either ExtensionsError ParsedExtensions -> Either ExtensionsError ParsedExtensions -> ExtensionsResult -- | stan build information. module Stan.Info -- | stan version information. data StanVersion StanVersion :: !String -> !String -> !String -> StanVersion [svVersion] :: StanVersion -> !String [svGitRevision] :: StanVersion -> !String [svCommitDate] :: StanVersion -> !String -- | Current stan version information. stanVersion :: StanVersion -- | Colourful pretty StanVersion representation used in the -- CLI. prettyStanVersion :: StanVersion -> String -- | Contains all stan System information data StanSystem StanSystem :: !String -> !String -> !String -> !String -> StanSystem [ssOs] :: StanSystem -> !String [ssArch] :: StanSystem -> !String [ssCompiler] :: StanSystem -> !String [ssCompilerVersion] :: StanSystem -> !String -- | All system info for the project stanSystem :: StanSystem -- | Data from different environment resources: -- -- data StanEnv StanEnv :: !Text -> ![FilePath] -> ![String] -> StanEnv [seEnvVars] :: StanEnv -> !Text [seTomlFiles] :: StanEnv -> ![FilePath] [seCliArgs] :: StanEnv -> ![String] data ProjectInfo ProjectInfo :: !String -> ![FilePath] -> !FilePath -> !Int -> ProjectInfo [piName] :: ProjectInfo -> !String [piCabalFiles] :: ProjectInfo -> ![FilePath] [piHieDir] :: ProjectInfo -> !FilePath [piFileNumber] :: ProjectInfo -> !Int instance GHC.Classes.Eq Stan.Info.ProjectInfo instance GHC.Show.Show Stan.Info.ProjectInfo instance GHC.Classes.Eq Stan.Info.StanEnv instance GHC.Show.Show Stan.Info.StanEnv instance GHC.Classes.Eq Stan.Info.StanSystem instance GHC.Show.Show Stan.Info.StanSystem instance GHC.Classes.Eq Stan.Info.StanVersion instance GHC.Show.Show Stan.Info.StanVersion -- | Data types and functions for working with meta information. module Stan.NameMeta -- | Meta information about function/type. data NameMeta NameMeta :: !Text -> !ModuleName -> !Text -> NameMeta [nameMetaPackage] :: NameMeta -> !Text [nameMetaModuleName] :: NameMeta -> !ModuleName [nameMetaName] :: NameMeta -> !Text -- | Pretty show NameMeta in the following format: -- package/module/name. prettyShowNameMeta :: NameMeta -> Text -- | Check if NameMeta is identical to Name. compareNames :: NameMeta -> Name -> Bool -- | Check whether HIE Identifier with details is a given -- NameMeta. hieMatchNameMeta :: NameMeta -> (Identifier, IdentifierDetails TypeIndex) -> Bool -- | Check if the given HieAST node is identifier equal to the given -- NameMeta. hieFindIdentifier :: NameMeta -> HieAST TypeIndex -> Maybe NameMeta -- | Create NameMeta for a function from the base package -- and a given ModuleName. module. baseNameFrom :: Text -> ModuleName -> NameMeta infix 8 `baseNameFrom` -- | Create NameMeta for a function from the base package -- and the GHC.List module. mkBaseListMeta :: Text -> NameMeta -- | Create NameMeta for a function from the base package -- and the Data.OldList module. mkBaseOldListMeta :: Text -> NameMeta -- | Create NameMeta for a function from the base package -- and the Data.Foldable module. mkBaseFoldableMeta :: Text -> NameMeta -- | Create NameMeta for a function from the -- unordered-containers package and a given ModuleName -- module. unorderedNameFrom :: Text -> ModuleName -> NameMeta infix 8 `unorderedNameFrom` -- | Create NameMeta for a function from the text package -- and a given ModuleName module. textNameFrom :: Text -> ModuleName -> NameMeta infix 8 `textNameFrom` -- | Create NameMeta for a function from the ghc-prim -- package and a given ModuleName module. ghcPrimNameFrom :: Text -> ModuleName -> NameMeta infix 8 `ghcPrimNameFrom` -- | NameMeta for primitive types. primTypeMeta :: Text -> NameMeta instance GHC.Classes.Eq Stan.NameMeta.NameMeta instance GHC.Show.Show Stan.NameMeta.NameMeta -- | Useful debugging and printing utilities for HIE types. They are -- implemented in two ways: -- --
    --
  1. Using derived Show instances.
  2. --
  3. Using ghc pretty-printing.
  4. --
-- -- To make full use of derived Show instances, add the -- pretty-simple package to dependencies and use the -- pPrint function from the Text.Pretty.Simple module. module Stan.Hie.Debug debugHieFile :: FilePath -> [HieFile] -> IO () instance GHC.Show.Show HieTypes.HieFile instance GHC.Show.Show a => GHC.Show.Show (HieTypes.HieType a) instance GHC.Show.Show a => GHC.Show.Show (HieTypes.HieAST a) instance GHC.Show.Show a => GHC.Show.Show (HieTypes.HieASTs a) instance GHC.Show.Show a => GHC.Show.Show (HieTypes.HieArgs a) instance GHC.Show.Show a => GHC.Show.Show (HieTypes.NodeInfo a) instance GHC.Show.Show a => GHC.Show.Show (HieTypes.IdentifierDetails a) instance GHC.Show.Show IfaceType.IfaceTyCon instance GHC.Show.Show IfaceType.IfaceTyConInfo instance GHC.Show.Show IfaceType.IfaceTyConSort instance GHC.Show.Show IfaceType.IfaceTyLit instance GHC.Show.Show BasicTypes.PromotionFlag instance GHC.Show.Show BasicTypes.TupleSort instance GHC.Show.Show Var.ArgFlag instance GHC.Show.Show Avail.AvailInfo instance GHC.Show.Show a => GHC.Show.Show (FieldLabel.FieldLbl a) instance GHC.Show.Show Module.Module instance GHC.Show.Show Module.ModuleName instance GHC.Show.Show Name.Name -- | Embedded DSL for patterns (AST and Type). Implemented using the -- Final Taggless approach. module Stan.Pattern.Edsl -- | Common interface for Bool-like parts of patterns. Allows to -- write composable and reusable complex pattern definitions from smaller -- pieces. -- -- Laws (in terms of matching functions that return Bool): -- -- class PatternBool a -- | Anything. Matching should always return True. (?) :: PatternBool a => a -- | Negation. Inverses the argument. neg :: PatternBool a => a -> a -- | Or-pattern. Choice. (|||) :: PatternBool a => a -> a -> a -- | And-pattern. Both. (&&&) :: PatternBool a => a -> a -> a infixr 2 ||| infixr 3 &&& -- | Patterns for types and type search. module Stan.Pattern.Type -- | Query pattern used to search types in HIE AST. data PatternType -- | Argument, type or constructor: -- -- TODO: table PatternTypeName :: !NameMeta -> ![PatternType] -> PatternType -- | Function pattern. PatternTypeFun :: !PatternType -> !PatternType -> PatternType -- | Type wildcard, matches anything. PatternTypeAnything :: PatternType -- | Choice between patterns. Should match either of them. PatternTypeOr :: !PatternType -> !PatternType -> PatternType -- | Union of patterns. Should match both of them. PatternTypeAnd :: !PatternType -> !PatternType -> PatternType -- | Negation of pattern. Should match everything except this pattern. PatternTypeNeg :: !PatternType -> PatternType -- | Short operator alias for PatternFun. (|->) :: PatternType -> PatternType -> PatternType infixr 4 |-> -- | Short operator alias for PatternTypeName. (|::) :: NameMeta -> [PatternType] -> PatternType infix 5 |:: -- | PatternType for list [a] or String. listPattern :: PatternType -- | PatternType for NonEmpty. nonEmptyPattern :: PatternType -- | PatternType for [a] -> _ or String -> -- _. listFunPattern :: PatternType -- | PatternType for Integer. integerPattern :: PatternType -- | PatternType for Natural. naturalPattern :: PatternType charPattern :: PatternType -- | PatternType for String. stringPattern :: PatternType -- | PatternType for Text. textPattern :: PatternType -- | List of types for STAN-0207. foldableTypesPatterns :: NonEmpty PatternType -- | Type patterns for the Foldable typeclass methods. Represented -- as a non-empty list of pairs: -- -- foldableMethodsPatterns :: NonEmpty (NameMeta, PatternType -> PatternType) instance GHC.Classes.Eq Stan.Pattern.Type.PatternType instance GHC.Show.Show Stan.Pattern.Type.PatternType instance Stan.Pattern.Edsl.PatternBool Stan.Pattern.Type.PatternType -- | Patterns for AST and syntax tree nodes search. module Stan.Pattern.Ast -- | Query pattern used to search AST nodes in HIE AST. This data type -- tries to mirror HIE AST to each future matching, so it's quite -- low-level, but helper functions are provided. data PatternAst -- | Integer constant in code. PatternAstConstant :: !Literal -> PatternAst -- | Name of a specific function, variable or data type. PatternAstName :: !NameMeta -> !PatternType -> PatternAst -- | Variable name. PatternAstVarName :: !String -> PatternAst -- | Set of context info (pairs of tags) | AST node with tags for current -- node and children patterns. This pattern should match the node -- exactly. PatternAstNode :: !Set (FastString, FastString) -> PatternAst PatternAstNodeExact :: !Set (FastString, FastString) -> ![PatternAst] -> PatternAst PatternAstAnything :: PatternAst -- | Choice between patterns. Should match either of them. PatternAstOr :: !PatternAst -> !PatternAst -> PatternAst -- | Union of patterns. Should match both of them. PatternAstAnd :: !PatternAst -> !PatternAst -> PatternAst -- | Negation of pattern. Should match everything except this pattern. PatternAstNeg :: !PatternAst -> PatternAst data Literal ExactNum :: !Int -> Literal ExactStr :: !ByteString -> Literal PrefixStr :: !ByteString -> Literal ContainStr :: !ByteString -> Literal AnyLiteral :: Literal -- | Function that creates PatternAst from the given non-empty list -- of pairs NameMeta and PatternType. -- -- If the list contains only one PatternType then it is simple -- PatternAstName. Else it is PatternAstOr of all such -- PatternAstNames. namesToPatternAst :: NonEmpty (NameMeta, PatternType) -> PatternAst -- | Like namesToPatternAst but doesn't care about types. anyNamesToPatternAst :: NonEmpty NameMeta -> PatternAst -- | app f x is a pattern for function application f x. app :: PatternAst -> PatternAst -> PatternAst -- | opApp x op y is a pattern for operator application x -- op y. opApp :: PatternAst -> PatternAst -> PatternAst -> PatternAst -- | Constructor of a plain data type or newtype. Children of node that -- matches this pattern are constructor fields. constructor :: PatternAst -- | data or newtype declaration. dataDecl :: PatternAst -- | Pattern for the top-level fixity declaration: -- --
--   infixr 7 ***, +++, ???
--   
fixity :: PatternAst -- | Pattern for the function definition: -- --
--   foo x y = ...
--   
fun :: PatternAst -- | Pattern for a single guard branch: -- --
--   | x < y = ...
--   
guardBranch :: PatternAst -- | Lazy data type field. Comes in two shapes: -- --
    --
  1. Record field, like: foo :: Text
  2. --
  3. Simple type: Int
  4. --
lazyField :: PatternAst -- | range a b is a pattern for [a .. b] range :: PatternAst -> PatternAst -> PatternAst -- | Pattern for the right-hand-side. Usually an equality sign. -- --
--   foo = baz
--   
rhs :: PatternAst -- | Pattern for tuples: -- -- tuple :: PatternAst -- | Pattern for the function type signature declaration: -- --
--   foo :: Some -> Type
--   
typeSig :: PatternAst -- | case' is a pattern for case EXP of expression (not -- considering branches). case' :: PatternAst -- | lambdaCase is a pattern for case expression (not -- considering branches). lambdaCase :: PatternAst -- | Pattern to represent one pattern matching branch. patternMatchBranch :: PatternAst -- | Pattern to represent right side of the pattern matching, e.g. -- -> "foo". patternMatchArrow :: PatternAst -> PatternAst -- | Pattern to represent one pattern matching branch on _. patternMatch_ :: PatternAst -> PatternAst -- | Pattern for literals in pattern matching. -- -- Note: presents on GHC >=8.10 only. literalPat :: PatternAst -- | Pattern for _ in pattern matching. -- -- Note: presents on GHC >=8.10 only. wildPat :: PatternAst -- | Annotations for constants: 0, "foo", etc. literalAnns :: (FastString, FastString) instance GHC.Classes.Eq Stan.Pattern.Ast.PatternAst instance GHC.Show.Show Stan.Pattern.Ast.PatternAst instance GHC.Classes.Eq Stan.Pattern.Ast.Literal instance GHC.Show.Show Stan.Pattern.Ast.Literal instance Stan.Pattern.Edsl.PatternBool Stan.Pattern.Ast.PatternAst -- | Functions to work with hie specific parts. module Stan.Hie -- | Returns contents of all .hie files recursively in the given -- hie directory. readHieFiles :: FilePath -> IO [HieFile] -- | Get the number of lines of code in the file by analising -- HieFile. countLinesOfCode :: HieFile -> Int -- | Compare two AST nodes on equality. This is a more relaxed version of -- the Eq instance for HieAST because it doesn't compare -- source locations. This function is useful if you want to check whether -- two AST nodes represent the same AST. -- -- This function needs to take the original HieFile because -- constants are not stored in HieAST and to compare constants we -- need to compare parts of source code. eqAst :: forall a. Eq a => HieFile -> HieAST a -> HieAST a -> Bool -- | Take sub-bytestring according to a given span. -- -- TODO: currently works only with single-line spans slice :: RealSrcSpan -> ByteString -> ByteString -- | Some Inspections require to know about types and some mechanism -- to match types to the given PatternType. This information on -- types/type expressions is taken from HIE files in a more -- suitable view. -- -- Let's take a look at the function foo: -- --
--   foo :: NonEmpty String -> Int
--   
-- -- In HIE files it will be stored as an Array like this: -- --
--   1 -> Int      []
--   2 -> String   []
--   3 -> NonEmpty [ 2 ]
--   4 -> FunType    3 1
--   
-- -- This module contains an implementation of the process of retrieval of -- this information from there. module Stan.Hie.MatchType -- | Matching function that searches the array of types recursively. hieMatchPatternType :: Array TypeIndex HieTypeFlat -> PatternType -> TypeIndex -> Bool -- | Some Inspections require to know about AST and some mechanism -- to match parts of syntax tree to the given PatternAst. This -- information on AST expressions is taken from HIE files in a -- more suitable view. -- -- This module contains an implementation of the process of retrieval of -- AST information from HIE files. module Stan.Hie.MatchAst -- | Matching function that matches current AST node with a given pattern. hieMatchPatternAst :: HieFile -> HieAST TypeIndex -> PatternAst -> Bool -- | Css to be used in the generated HTML in the report. module Stan.Report.Css stanCss :: Css -- | Report settings types. module Stan.Report.Settings -- | Settings for produced report. data ReportSettings ReportSettings :: !Verbosity -> !ToggleSolution -> ReportSettings [reportSettingsVerbosity] :: ReportSettings -> !Verbosity [reportSettingsSolutionVerbosity] :: ReportSettings -> !ToggleSolution data Verbosity Verbose :: Verbosity NonVerbose :: Verbosity isVerbose :: Verbosity -> Bool -- | Boolean for showing/hiding solution information of observations. data ToggleSolution HideSolution :: ToggleSolution ShowSolution :: ToggleSolution -- | Is the toggle option set to HideSolution? isHidden :: ToggleSolution -> Bool instance GHC.Show.Show Stan.Report.Settings.ToggleSolution instance GHC.Show.Show Stan.Report.Settings.Verbosity -- | This module introduces Severity data type for expressing how -- severe the message is. Also, it contains useful functions to work with -- Severity. module Stan.Severity -- | Severity level of the inspection. -- -- TODO: table data Severity -- | Code style issues. Usually harmless. Style :: Severity -- | Serious defects that could cause slowness and space leaking. Performance :: Severity -- | Human errors in code. PotentialBug :: Severity -- | Potential runtime errors on some inputs. Warning :: Severity -- | Dangerous behaviour. Error :: Severity -- | Description of each Severity level. severityDescription :: Severity -> Text -- | Get the colour of the severity level. severityColour :: Severity -> Text -- | Show Severity in a human-friendly format. prettyShowSeverity :: Severity -> Text instance GHC.Enum.Bounded Stan.Severity.Severity instance GHC.Enum.Enum Stan.Severity.Severity instance GHC.Classes.Ord Stan.Severity.Severity instance GHC.Classes.Eq Stan.Severity.Severity instance GHC.Read.Read Stan.Severity.Severity instance GHC.Show.Show Stan.Severity.Severity -- | Inspection — check or test provided by Stan. module Stan.Inspection -- | Data type that represents a check/test, or how we call it -- inspection that is provided by the Stan tool. data Inspection Inspection :: !Id Inspection -> !Text -> !Text -> ![Text] -> !NonEmpty Category -> !Severity -> !InspectionAnalysis -> Inspection [inspectionId] :: Inspection -> !Id Inspection [inspectionName] :: Inspection -> !Text [inspectionDescription] :: Inspection -> !Text [inspectionSolution] :: Inspection -> ![Text] [inspectionCategory] :: Inspection -> !NonEmpty Category [inspectionSeverity] :: Inspection -> !Severity [inspectionAnalysis] :: Inspection -> !InspectionAnalysis categoryL :: Lens' Inspection (NonEmpty Category) descriptionL :: Lens' Inspection Text solutionL :: Lens' Inspection [Text] severityL :: Lens' Inspection Severity analysisL :: Lens' Inspection InspectionAnalysis -- | Data type that represents all possible types of stan -- inspections in a uniformed way. data InspectionAnalysis -- | Find the specific part of the Haskell AST (including specific -- functions). FindAst :: !PatternAst -> InspectionAnalysis -- | Find all operators without matching infix[r|l] Infix :: InspectionAnalysis -- | Check if the data type has lazy fields LazyField :: InspectionAnalysis -- | Usage of tuples with size >= 4 BigTuples :: InspectionAnalysis -- | Pattern matching on _ for sum types. PatternMatchOn_ :: InspectionAnalysis -- | Replace multiple comparison operations with compare UseCompare :: InspectionAnalysis -- | Type alias for the HashMap that contains pairs of inspections -- Ids and corresponding Inspections. type InspectionsMap = HashMap (Id Inspection) Inspection -- | Sort Inspection by Id sortById :: InspectionsMap -> [Inspection] -- | Show Inspection in a human-friendly format. prettyShowInspection :: Inspection -> Text -- | Show the short view of a given Inspection. prettyShowInspectionShort :: Inspection -> Text -- | Create the MarkDown text for all inspections. The generated MD has a -- ToC and separate sections for each inspection. -- -- This is used to keep the Wiki page of the project up to date. inspectionsMd :: [Inspection] -> Text instance GHC.Classes.Eq Stan.Inspection.Inspection instance GHC.Show.Show Stan.Inspection.Inspection instance GHC.Classes.Eq Stan.Inspection.InspectionAnalysis instance GHC.Show.Show Stan.Inspection.InspectionAnalysis -- | Contains all Inspections for style improvements. -- -- The style inspections are in ranges: -- -- module Stan.Inspection.Style -- | Inspection — missing fixity declaration STAN-0301. stan0301 :: Inspection -- | Inspection — to big tuples STAN-0302. stan0302 :: Inspection -- | All anti-pattern Inspections map from Ids. styleInspectionsMap :: InspectionsMap -- | Contains all Inspections for partial functions. -- -- The partial inspections are in ranges: -- -- module Stan.Inspection.Partial -- | Inspection — partial head STAN-0001. stan0001 :: Inspection -- | Inspection — partial tail STAN-0002. stan0002 :: Inspection -- | Inspection — partial init STAN-0003. stan0003 :: Inspection -- | Inspection — partial last STAN-0004. stan0004 :: Inspection -- | Inspection — partial !! STAN-0005. stan0005 :: Inspection -- | Inspection — partial cycle STAN-0006. stan0006 :: Inspection -- | Inspection — partial genericIndex STAN-0007. stan0007 :: Inspection -- | Inspection — partial fromJust STAN-0008. stan0008 :: Inspection -- | Inspection — partial read STAN-0009. stan0009 :: Inspection -- | Inspection — partial succ STAN-0010. stan0010 :: Inspection -- | Inspection — partial pred STAN-0011. stan0011 :: Inspection -- | Inspection — partial toEnum STAN-0012. stan0012 :: Inspection -- | Inspection — partial maximum STAN-0013. stan0013 :: Inspection -- | Inspection — partial minimum STAN-0014. stan0014 :: Inspection -- | Inspection — partial maximumBy STAN-0015. stan0015 :: Inspection -- | Inspection — partial minimumBy STAN-0016. stan0016 :: Inspection -- | Inspection — partial foldl1 STAN-0017. stan0017 :: Inspection -- | Inspection — partial 'Data.Foldable.foldl1'' -- STAN-0018. stan0018 :: Inspection -- | Inspection — partial foldr1 STAN-0019. stan0019 :: Inspection -- | Inspection — partial fromList STAN-0020. stan0020 :: Inspection -- | Inspection — partial fromInteger STAN-0021. stan0021 :: Inspection -- | All partial Inspections. partialInspectionsMap :: InspectionsMap -- | Contains all Inspections for functions that hang on infinite -- lists. -- -- The infinite inspections are in ranges: -- -- module Stan.Inspection.Infinite -- | Inspection for stan0101 — infinite reverse -- STAN-0101. stan0101 :: Inspection -- | Inspection for stan0102 — infinite isSuffixOf -- STAN-0102. stan0102 :: Inspection -- | Inspection for stan0103 — infinite length | -- length STAN-0103. stan0103 :: Inspection -- | Inspection for stan0104 — infinite genericLength -- STAN-0104. stan0104 :: Inspection -- | Inspection for stan0105 — infinite sum -- STAN-0105. stan0105 :: Inspection -- | Inspection for stan0106 — infinite product -- STAN-0106. stan0106 :: Inspection -- | All infinite Inspections map from Ids. infiniteInspectionsMap :: InspectionsMap -- | Contains all Inspections for known anti-patterns. -- -- The anti-pattern inspections are in ranges: -- -- module Stan.Inspection.AntiPattern -- | Inspection[0 .. length xs] STAN-0201. stan0201 :: Inspection -- | Inspectionfoldl STAN-0202. stan0202 :: Inspection -- | Inspectionpack STAN-0203. stan0203 :: Inspection -- | Inspection — slow size and length -- STAN-0204. stan0204 :: Inspection -- | Inspection — slow size STAN-0205. stan0205 :: Inspection -- | Inspection — missing strictness declaration STAN-0206. stan0206 :: Inspection -- | InspectionFoldable methods on possibly error-prone -- structures STAN-0207. stan0207 :: Inspection -- | Inspection — slow length for Text -- STAN-0208. stan0208 :: Inspection -- | Inspection — slow nub for lists STAN-0209. stan0209 :: Inspection -- | Inspection — slow for_ and forM_ for ranges -- STAN-0210. stan0210 :: Inspection -- | Inspection/ on URLs STAN-0211. stan0211 :: Inspection -- | Inspection — usage of unsafe* functions -- STAN-0212. stan0212 :: Inspection -- | Inspection — Pattent matching on _ for sum types — -- STAN-0213. stan0213 :: Inspection -- | Inspection — use compare STAN-0214. stan0214 :: Inspection -- | Inspection — Slashes in paths STAN-0215. stan0215 :: Inspection -- | All anti-pattern Inspections map from Ids. antiPatternInspectionsMap :: InspectionsMap -- | Contains lists of all Inspections and Inspection -- Ids provided by Stan. module Stan.Inspection.All -- | All Inspections map from Ids. inspectionsMap :: InspectionsMap -- | List of all inspections. inspections :: [Inspection] -- | Set of all inspection Ids. inspectionsIds :: HashSet (Id Inspection) -- | Look up Inspection by the given inspection Id. lookupInspectionById :: Id Inspection -> Maybe Inspection -- | Get the Inspection by the given known inspection Id. getInspectionById :: Id Inspection -> Inspection -- | Observation — a vulnerability found in the target project by -- Stan. module Stan.Observation -- | Data type to represent discovered by Stan vulnerabilities. data Observation Observation :: !Id Observation -> !Id Inspection -> !RealSrcSpan -> !FilePath -> !ModuleName -> !ByteString -> Observation [observationId] :: Observation -> !Id Observation [observationInspectionId] :: Observation -> !Id Inspection [observationLoc] :: Observation -> !RealSrcSpan [observationFile] :: Observation -> !FilePath [observationModuleName] :: Observation -> !ModuleName [observationFileContent] :: Observation -> !ByteString -- | Type alias for the sized list of Observations. type Observations = Slist Observation -- | Smart constructor for Observations from HieFiles. mkObservation :: Id Inspection -> HieFile -> RealSrcSpan -> Observation -- | Create a stable Observation Id in a such way that: -- --
    --
  1. Id doesn't depend on other inspections in this file.
  2. --
  3. Id uniquely identifies Observation location.
  4. --
  5. Ids are guaranteed to be the same if the module content -- didn't change between different stan runs.
  6. --
-- -- The Observation Id should look like this: -- --
--   OBS-STAN-XXXX-module-name-hash-10:42
--   
mkObservationId :: Id Inspection -> ModuleName -> RealSrcSpan -> Id Observation ignoredObservations :: [Id Observation] -> Observations -> ([Id Observation], [Id Observation]) -- | Show Observation in a human-friendly format. prettyShowObservation :: ReportSettings -> Observation -> Text prettyShowIgnoredObservations :: [Id Observation] -> Observations -> Text prettyObservationSource :: Bool -> Observation -> [Text] instance GHC.Classes.Eq Stan.Observation.Observation instance GHC.Show.Show Stan.Observation.Observation -- | File (or module) specific information. module Stan.FileInfo type FileMap = Map FilePath FileInfo -- | File specific information. data FileInfo FileInfo :: !FilePath -> !ModuleName -> !Int -> !Either ExtensionsError ParsedExtensions -> !Either ExtensionsError ParsedExtensions -> !ExtensionsResult -> !Observations -> FileInfo [fileInfoPath] :: FileInfo -> !FilePath [fileInfoModuleName] :: FileInfo -> !ModuleName [fileInfoLoc] :: FileInfo -> !Int [fileInfoCabalExtensions] :: FileInfo -> !Either ExtensionsError ParsedExtensions [fileInfoExtensions] :: FileInfo -> !Either ExtensionsError ParsedExtensions [fileInfoMergedExtensions] :: FileInfo -> !ExtensionsResult [fileInfoObservations] :: FileInfo -> !Observations -- | Return the list of pretty-printed extensions. extensionsToText :: Either ExtensionsError ParsedExtensions -> [Text] -- | Check whether the given extension is disabled isExtensionDisabled :: Extension -> ExtensionsResult -> Bool instance GHC.Classes.Eq Stan.FileInfo.FileInfo instance GHC.Show.Show Stan.FileInfo.FileInfo -- | Analysing functions by InspectionAnalysis for the corresponding -- Inspection. module Stan.Analysis.Analyser -- | Create analysing function for Inspection by pattern-matching -- over InspectionAnalysis. analysisByInspection :: ExtensionsResult -> Inspection -> HieFile -> Observations -- | Static analysis of all HIE files. module Stan.Analysis -- | This data type stores all information collected during static -- analysis. data Analysis Analysis :: !Int -> !Int -> !(Set OnOffExtension, Set SafeHaskellExtension) -> !HashSet (Id Inspection) -> !Observations -> !Observations -> !FileMap -> Analysis [analysisModulesNum] :: Analysis -> !Int [analysisLinesOfCode] :: Analysis -> !Int [analysisUsedExtensions] :: Analysis -> !(Set OnOffExtension, Set SafeHaskellExtension) [analysisInspections] :: Analysis -> !HashSet (Id Inspection) [analysisObservations] :: Analysis -> !Observations [analysisIgnoredObservations] :: Analysis -> !Observations [analysisFileMap] :: Analysis -> !FileMap -- | Perform static analysis of given HieFile. runAnalysis :: Map FilePath (Either ExtensionsError ParsedExtensions) -> HashMap FilePath (HashSet (Id Inspection)) -> [Id Observation] -> [HieFile] -> Analysis instance GHC.Show.Show Stan.Analysis.Analysis -- | Pretty printing of Stan's analysis. module Stan.Analysis.Pretty -- | Shows analysed output of Stan work. This functions groups -- Observations by FilePath they are found in. prettyShowAnalysis :: Analysis -> ReportSettings -> Text data AnalysisNumbers AnalysisNumbers :: !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Double -> AnalysisNumbers [anModules] :: AnalysisNumbers -> !Int [anLoc] :: AnalysisNumbers -> !Int [anExts] :: AnalysisNumbers -> !Int [anSafeExts] :: AnalysisNumbers -> !Int [anIns] :: AnalysisNumbers -> !Int [anFoundObs] :: AnalysisNumbers -> !Int [anIgnoredObs] :: AnalysisNumbers -> !Int [anHealth] :: AnalysisNumbers -> !Double -- | Enum to describe project health depending on the value of -- anHealth. data ProjectHealth Unhealthy :: ProjectHealth LowHealth :: ProjectHealth MediumHealth :: ProjectHealth Healthy :: ProjectHealth analysisToNumbers :: Analysis -> AnalysisNumbers -- | Show project health as pretty text with 2 digits after dot. prettyHealth :: Double -> Text -- | Calculate ProjectHealth. toProjectHealth :: Double -> ProjectHealth -- | stan runtime configuration that allows customizing the set of -- inspections to check the code against. module Stan.Config -- | Main configuration type for the following purposes: -- -- data ConfigP (p :: Phase Text) ConfigP :: !p ::- [Check] -> !p ::- [Scope] -> !p ::- [Id Observation] -> ConfigP (p :: Phase Text) [configChecks] :: ConfigP (p :: Phase Text) -> !p ::- [Check] [configRemoved] :: ConfigP (p :: Phase Text) -> !p ::- [Scope] [configIgnored] :: ConfigP (p :: Phase Text) -> !p ::- [Id Observation] type Config = ConfigP 'Final type PartialConfig = ConfigP 'Partial -- | Rule to control the set of inspections per scope. data Check Check :: !CheckType -> !CheckFilter -> !Scope -> Check [checkType] :: Check -> !CheckType [checkFilter] :: Check -> !CheckFilter [checkScope] :: Check -> !Scope -- | Type of Check: Include or Exclude -- Inspections. data CheckType Include :: CheckType Exclude :: CheckType -- | Criterion for inspections filtering. data CheckFilter CheckInspection :: !Id Inspection -> CheckFilter CheckSeverity :: !Severity -> CheckFilter CheckCategory :: !Category -> CheckFilter CheckAll :: CheckFilter -- | Where to apply the rule for controlling inspection set. data Scope ScopeFile :: !FilePath -> Scope ScopeDirectory :: !FilePath -> Scope ScopeAll :: Scope defaultConfig :: PartialConfig mkDefaultChecks :: [FilePath] -> HashMap FilePath (HashSet (Id Inspection)) finaliseConfig :: PartialConfig -> Trial Text Config -- | Convert TOML configuration to the equivalent CLI command that can be -- copy-pasted to get the same results as using the TOML config. -- --
--     ⓘ Reading Configurations from /home/vrom911/Kowainik/stan/.stan.toml ...
--   stan check --exclude --directory=test/ \
--        check --include \
--        check --exclude --inspectionId=STAN-0002 \
--        check --exclude --inspectionId=STAN-0001 --file=src/MyFile.hs
--        remove --file=src/Secret.hs
--        ignore --id="STAN0001-asdfgh42:42"
--   
configToCliCommand :: Config -> Text -- | Apply configuration to the given list of files to get the set of -- inspections for each file. -- -- The algorithm: -- --
    --
  1. Remove all files specified by the remove option.
  2. --
  3. Run applyChecks on the remaining files.
  4. --
applyConfig :: [FilePath] -> Config -> HashMap FilePath (HashSet (Id Inspection)) -- | Convert the list of Checks from Config to data structure -- that allows filtering of Inspections for given files. applyChecks :: [FilePath] -> [Check] -> HashMap FilePath (HashSet (Id Inspection)) -- | Modify existing Checks for each file using the given list of -- Checks. applyChecksFor :: HashMap FilePath (HashSet (Id Inspection)) -> [Check] -> HashMap FilePath (HashSet (Id Inspection)) instance GHC.Classes.Eq Stan.Config.Check instance GHC.Show.Show Stan.Config.Check instance GHC.Classes.Eq Stan.Config.Scope instance GHC.Show.Show Stan.Config.Scope instance GHC.Classes.Eq Stan.Config.CheckFilter instance GHC.Show.Show Stan.Config.CheckFilter instance GHC.Enum.Bounded Stan.Config.CheckType instance GHC.Enum.Enum Stan.Config.CheckType instance GHC.Classes.Eq Stan.Config.CheckType instance GHC.Show.Show Stan.Config.CheckType instance (GHC.Show.Show (p Trial.::- [Stan.Config.Check]), GHC.Show.Show (p Trial.::- [Stan.Config.Scope]), GHC.Show.Show (p Trial.::- [Stan.Core.Id.Id Stan.Observation.Observation])) => GHC.Show.Show (Stan.Config.ConfigP p) instance (GHC.Classes.Eq (p Trial.::- [Stan.Config.Check]), GHC.Classes.Eq (p Trial.::- [Stan.Config.Scope]), GHC.Classes.Eq (p Trial.::- [Stan.Core.Id.Id Stan.Observation.Observation])) => GHC.Classes.Eq (Stan.Config.ConfigP p) instance GHC.Base.Semigroup Stan.Config.PartialConfig -- | stan configuration pretty printing helper functions. module Stan.Config.Pretty data ConfigAction RemoveAction :: ConfigAction IncludeAction :: ConfigAction ExcludeAction :: ConfigAction IgnoreAction :: ConfigAction prettyConfigAction :: ConfigAction -> Text configActionClass :: ConfigAction -> Text configActionColour :: ConfigAction -> Text prettyConfigCli :: Config -> Text configToTriples :: Config -> [(ConfigAction, Text, Text)] instance GHC.Classes.Eq Stan.Config.Pretty.ConfigAction instance GHC.Show.Show Stan.Config.Pretty.ConfigAction -- | CLI commands and options for stan. module Stan.Cli -- | Commands used in Stan CLI. data StanCommand -- | Just stan with its options. Stan :: !StanArgs -> StanCommand -- | stan inspection. StanInspection :: !InspectionArgs -> StanCommand -- |
--   stan toml-to-cli
--   
StanTomlToCli :: !TomlToCliArgs -> StanCommand -- |
--   stan cli-to-toml
--   
StanCliToToml :: !CliToTomlArgs -> StanCommand -- |
--   stan inspections-to-md
--   
StanInspectionsToMd :: StanCommand -- | Options used for the main stan command. data StanArgs StanArgs :: !FilePath -> ![FilePath] -> !ReportSettings -> !Bool -> !TaggedTrial Text Bool -> !Maybe FilePath -> !PartialConfig -> StanArgs -- | Directory with HIE files [stanArgsHiedir] :: StanArgs -> !FilePath -- | Path to .cabal files. [stanArgsCabalFilePath] :: StanArgs -> ![FilePath] -- | Settings for report [stanArgsReportSettings] :: StanArgs -> !ReportSettings -- | Create HTML report? [stanArgsReport] :: StanArgs -> !Bool -- | Use default .stan.toml file [stanArgsUseDefaultConfigFile] :: StanArgs -> !TaggedTrial Text Bool -- | Path to a custom configurations file. [stanArgsConfigFile] :: StanArgs -> !Maybe FilePath [stanArgsConfig] :: StanArgs -> !PartialConfig -- | Options used for the stan inspection command. newtype InspectionArgs InspectionArgs :: Maybe (Id Inspection) -> InspectionArgs [inspectionArgsId] :: InspectionArgs -> Maybe (Id Inspection) -- | Options used for the stan toml-to-cli command. newtype TomlToCliArgs TomlToCliArgs :: Maybe FilePath -> TomlToCliArgs [tomlToCliArgsFilePath] :: TomlToCliArgs -> Maybe FilePath -- | Options used for the stan cli-to-toml command. data CliToTomlArgs CliToTomlArgs :: !Maybe FilePath -> !PartialConfig -> CliToTomlArgs [cliToTomlArgsFilePath] :: CliToTomlArgs -> !Maybe FilePath [cliToTomlArgsConfig] :: CliToTomlArgs -> !PartialConfig -- | Run main parser of the stan command line tool. runStanCli :: IO StanCommand -- | To turn on some special options. stanParserPrefs :: ParserPrefs stanCliParser :: ParserInfo StanCommand -- | Static analysis summary. module Stan.Analysis.Summary -- | Short info about analysis. data Summary Summary :: !Id Inspection -> !Category -> !ModuleName -> !Severity -> Summary -- | The most popular Inspection [summaryInspectionId] :: Summary -> !Id Inspection -- | The most popular Category [summaryCategory] :: Summary -> !Category -- | Module with the biggest number of observations [summaryModule] :: Summary -> !ModuleName -- | The highest Severity [summarySeverity] :: Summary -> !Severity -- | Assemble Summary after analysis. Returns Nothing when -- there's no Observations. Otherwise, there's at least one -- observation, which means that we can find the most popular -- Inspection, Category and the highest Severity. createSummary :: Analysis -> Maybe Summary -- | HTML to be generated in the report. module Stan.Report.Html stanHtml :: Analysis -> Config -> [Text] -> StanEnv -> ProjectInfo -> Html -- | Report and report settings types. module Stan.Report generateReport :: Analysis -> Config -> [Text] -> StanEnv -> ProjectInfo -> IO () -- | tomland library integration. TomlCodecs for the -- Config data type. module Stan.Toml getTomlConfig :: Bool -> Maybe FilePath -> IO PartialConfig configCodec :: TomlCodec PartialConfig -- | Based on the incoming settings returns the TOML configuration files -- that were used to get the final config. usedTomlFiles :: Bool -> Maybe FilePath -> IO [FilePath] -- | Main running module. module Stan run :: IO () -- | From a given path to cabal files and HieFiles create the map -- from modules (that are in .cabal file) to the resulting parsed -- extensions for each. createCabalExtensionsMap :: [FilePath] -> [HieFile] -> IO (Map FilePath (Either ExtensionsError ParsedExtensions))