stan-0.2.0.0: Haskell STatic ANalyser

Copyright | (c) 2020 Kowainik
License | MPL-2.0
Maintainer | Kowainik <xrom.xkov@gmail.com>
Safe Haskell | None
Language | Haskell2010

Stan.Inspection

Contents

- Stan inspection type
- Inspection info
- Sorting
- Pretty print
  - Markdown

Description

Inspection — check or test provided by Stan.

Synopsis

- data Inspection = Inspection {
  - inspectionId :: !(Id Inspection)
  - inspectionName :: !Text
  - inspectionDescription :: !Text
  - inspectionSolution :: ![Text]
  - inspectionCategory :: !(NonEmpty Category)
  - inspectionSeverity :: !Severity
  - inspectionAnalysis :: !InspectionAnalysis
  }
- categoryL :: Lens' Inspection (NonEmpty Category)
- descriptionL :: Lens' Inspection Text
- solutionL :: Lens' Inspection [Text]
- severityL :: Lens' Inspection Severity
- analysisL :: Lens' Inspection InspectionAnalysis
- data InspectionAnalysis
  - = FindAst !PatternAst
  - | Infix
  - | LazyField
  - | BigTuples
  - | PatternMatchOn_
  - | UseCompare
- type InspectionsMap = HashMap (Id Inspection) Inspection
- sortById :: InspectionsMap -> [Inspection]
- prettyShowInspection :: Inspection -> Text
- prettyShowInspectionShort :: Inspection -> Text
- inspectionsMd :: [Inspection] -> Text

# Stan inspection type

data Inspection #

Data type that represents a check/test, or how we call it inspection that is provided by the Stan tool.

Constructors

Inspection |
Fields inspectionId :: !(Id Inspection) inspectionName :: !Text inspectionDescription :: !Text inspectionSolution :: ![Text] inspectionCategory :: !(NonEmpty Category) inspectionSeverity :: !Severity inspectionAnalysis :: !InspectionAnalysis

#### Instances

Instances details

Show Inspection # |
Instance details Defined in Stan.Inspection Methods showsPrec :: Int -> Inspection -> ShowS # show :: Inspection -> String # showList :: [Inspection] -> ShowS #
Eq Inspection # |
Instance details Defined in Stan.Inspection Methods (==) :: Inspection -> Inspection -> Bool # (/=) :: Inspection -> Inspection -> Bool #
ToJSON Inspection # |
Instance details Defined in Stan.Inspection Methods toJSON :: Inspection -> Value #

categoryL :: Lens' Inspection (NonEmpty Category) #

descriptionL :: Lens' Inspection Text #

solutionL :: Lens' Inspection [Text] #

severityL :: Lens' Inspection Severity #

analysisL :: Lens' Inspection InspectionAnalysis #

# Inspection info

data InspectionAnalysis #

Data type that represents all possible types of `stan` inspections in a uniformed way.

Constructors

FindAst !PatternAst | Find the specific part of the Haskell AST (including specific functions).
Infix | Find all operators without matching `infix[r|l]`
LazyField | Check if the data type has lazy fields
BigTuples | Usage of tuples with size >= 4
PatternMatchOn_ | Pattern matching on `_` for sum types.
UseCompare | Replace multiple comparison operations with `compare`

#### Instances

Instances details

Show InspectionAnalysis # |
Instance details Defined in Stan.Inspection Methods showsPrec :: Int -> InspectionAnalysis -> ShowS # show :: InspectionAnalysis -> String # showList :: [InspectionAnalysis] -> ShowS #
Eq InspectionAnalysis # |
Instance details Defined in Stan.Inspection Methods (==) :: InspectionAnalysis -> InspectionAnalysis -> Bool # (/=) :: InspectionAnalysis -> InspectionAnalysis -> Bool #

type InspectionsMap = HashMap (Id Inspection) Inspection #

Type alias for the `HashMap` that contains pairs of inspections `Id`s and corresponding `Inspection`s.

# Sorting

sortById :: InspectionsMap -> [Inspection] #

Sort `Inspection` by `Id`

# Pretty print

prettyShowInspection :: Inspection -> Text #

Show `Inspection` in a human-friendly format.

prettyShowInspectionShort :: Inspection -> Text #

Show the short view of a given `Inspection`.

## Markdown

inspectionsMd :: [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.