Copyright | (c) 2015 Michele Lacchia |
---|---|
License | ISC |
Maintainer | Michele Lacchia <michelelacchia@gmail.com> |
Stability | alpha |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Programmatic interface to Argon.
- type AnalysisResult = Either String [ComplexityBlock]
- newtype ComplexityBlock = CC (Loc, String, Int)
- data OutputMode
- data Config = Config {
- minCC :: Int
- outputMode :: OutputMode
- type Loc = (Int, Int)
- type LModule = Located (HsModule RdrName)
- analyze :: FilePath -> IO (FilePath, AnalysisResult)
- parseModule :: FilePath -> IO (Either String LModule)
- order :: [ComplexityBlock] -> [ComplexityBlock]
- filterResults :: Config -> (FilePath, AnalysisResult) -> (FilePath, AnalysisResult)
- export :: Config -> [(FilePath, AnalysisResult)] -> String
Types
type AnalysisResult = Either String [ComplexityBlock] Source
Represent the result of the analysis of one file.
It can either be an error message or a list of
ComplexityBlock
s.
newtype ComplexityBlock Source
Hold the data associated to a function binding:
(location, function name, complexity)
.
data OutputMode Source
Type describing how the results should be exported.
Type holding all the options passed from the command line.
Config | |
|
Type synonym representing a location in the source code. The tuple
represents the following: (start line, start col)
.
type LModule = Located (HsModule RdrName) Source
Type synonym for a syntax node representing a module tagged with a
SrcSpan
Parsing
:: FilePath | The filename corresponding to the source code |
-> IO (FilePath, AnalysisResult) |
Parse the code in the given filename and compute cyclomatic complexity for every function binding.
parseModule :: FilePath -> IO (Either String LModule) Source
Parse a module with the default instructions for the C pre-processor
Manipulating results
order :: [ComplexityBlock] -> [ComplexityBlock] Source
Order a list of blocks. Ordering is done with respect to:
- complexity (descending)
- line number (ascending)
- function name (alphabetically)
filterResults :: Config -> (FilePath, AnalysisResult) -> (FilePath, AnalysisResult) Source
Filter the results of the analysis, with respect to the given
Config
.