-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Measure your code's complexity -- -- Argon performs static analysis on your code in order to compute -- cyclomatic complexity. It is a quantitative measure of the number of -- linearly indipendent paths through the code. -- -- The intended usage is through Argon's executable, which accepts a list -- of file paths to analyze. The data can be optionally exported to JSON. @package argon @version 0.4.0.0 -- | Programmatic interface to Argon. module Argon -- | Represent the result of the analysis of one file. It can either be an -- error message or a list of ComplexityBlocks. type AnalysisResult = Either String [ComplexityBlock] -- | Hold the data associated to a function binding: (location, -- function name, complexity). newtype ComplexityBlock CC :: (Loc, String, Int) -> ComplexityBlock -- | Type describing how the results should be exported. data OutputMode -- | Text-only output, no colors. BareText :: OutputMode -- | Text-only output, with colors. Colored :: OutputMode -- | Data is serialized to JSON. JSON :: OutputMode -- | Type holding all the options passed from the command line. data Config Config :: Int -> [ExtensionFlag] -> [FilePath] -> [FilePath] -> OutputMode -> Config -- | Minimum complexity a block has to have to be shown in results. [minCC] :: Config -> Int -- | Path to the main Cabal file [exts] :: Config -> [ExtensionFlag] -- | Header files to be automatically included before preprocessing [headers] :: Config -> [FilePath] -- | Additional include directories for the C preprocessor [includeDirs] :: Config -> [FilePath] -- | Describe how the results should be exported. [outputMode] :: Config -> OutputMode -- | Default configuration options. -- -- Warning: These are not Argon's default options. defaultConfig :: Config -- | Type synonym representing a location in the source code. The tuple -- represents the following: (start line, start col). type Loc = (Int, Int) -- | Type synonym for a syntax node representing a module tagged with a -- SrcSpan type LModule = Located (HsModule RdrName) -- | Starting from a list of paths, generate a sequence of paths -- corresponding to Haskell files. The fileystem is traversed in a manner -- similar to reversed DFS. allFiles :: [FilePath] -> IO (Seq FilePath) -- | Parse the code in the given filename and compute cyclomatic complexity -- for every function binding. analyze :: Config -> FilePath -> IO (FilePath, AnalysisResult) -- | Parse a module with the default instructions for the C pre-processor -- Only the includes directory is taken from the config parseModule :: Config -> FilePath -> IO (Either String LModule) -- | Parse the given Cabal file generate a list of GHC extension flags. The -- extension names are read from the default-extensions field in the -- library section. parseExts :: FilePath -> IO [ExtensionFlag] -- | A Map from extensions names to extensions flags flagsMap :: Map String ExtensionFlag -- | Order a list of blocks. Ordering is done with respect to: -- --
    --
  1. complexity (descending)
  2. --
  3. line number (ascending)
  4. --
  5. function name (alphabetically)
  6. --
order :: [ComplexityBlock] -> [ComplexityBlock] -- | Filter the results of the analysis, with respect to the given -- Config. filterResults :: Config -> (FilePath, AnalysisResult) -> (FilePath, AnalysisResult) -- | A result is discarded if it correspond to a successful analysis and -- there are no blocks to show filterNulls :: (FilePath, AnalysisResult) -> Bool -- | Export analysis' results. How to export the data is defined by the -- Config parameter. exportStream :: Config -> Producer (FilePath, AnalysisResult) IO () -> Effect IO ()