argon-0.2.0.0: Measure your code's complexity

Copyright(c) 2015 Michele Lacchia
LicenseISC
MaintainerMichele Lacchia <michelelacchia@gmail.com>
Stabilityalpha
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Argon

Contents

Description

Programmatic interface to Argon.

Synopsis

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 ComplexityBlocks.

newtype ComplexityBlock Source

Hold the data associated to a function binding: (line number, column, function name, complexity).

Constructors

CC (Int, Int, String, Int) 

data OutputMode Source

Type describing how the results should be exported.

Constructors

BareText

Text-only output, no colors.

Colored

Text-only output, with colors.

JSON

Data is serialized to JSON.

data Config Source

Type holding all the options passed from the command line.

Constructors

Config 

Fields

minCC :: Int

Minimum complexity a block has to have to be shown in results.

outputMode :: OutputMode

Describe how the results should be exported.

Parsing

parseCode Source

Arguments

:: Maybe String

The filename corresponding to the source code

-> String

The source code

-> IO (FilePath, AnalysisResult) 

Parse the given code and compute cyclomatic complexity for every function binding.

Manipulating results

order :: [ComplexityBlock] -> [ComplexityBlock] Source

Order a list of blocks. Ordering is done with respect to:

  1. complexity (descending)
  2. line number (ascending)
  3. function name (alphabetically)

filterResults :: Config -> (FilePath, AnalysisResult) -> (FilePath, AnalysisResult) Source

Filter the results of the analysis, with respect to the given ResultsOptions.

export :: Config -> [(FilePath, AnalysisResult)] -> String Source

Export analysis' results. How to export the data is defined by the ResultsOptions.