Skip to content

All Inspections

Veronika Romashkina edited this page Jun 20, 2020 · 4 revisions

This document contains information about all inspections used in Stan to find observations in your projects. Below you can see more details about each inspection individually

Table of all Inspections

STAN-0001

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0001
Name Partial: base/head
Description Usage of partial function 'head' for lists
Severity Warning
Category #Partial #List

Possible solutions for STAN-0001

  • Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
  • Use explicit pattern-matching over lists

STAN-0002

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0002
Name Partial: base/tail
Description Usage of partial function 'tail' for lists
Severity Warning
Category #Partial #List

Possible solutions for STAN-0002

  • Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
  • Use explicit pattern-matching over lists

STAN-0003

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0003
Name Partial: base/init
Description Usage of partial function 'init' for lists
Severity Warning
Category #Partial #List

Possible solutions for STAN-0003

  • Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
  • Use explicit pattern-matching over lists

STAN-0004

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0004
Name Partial: base/last
Description Usage of partial function 'last' for lists
Severity Warning
Category #Partial #List

Possible solutions for STAN-0004

  • Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
  • Use explicit pattern-matching over lists

STAN-0005

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0005
Name Partial: base/!!
Description Usage of partial function '!!' for lists
Severity Warning
Category #Partial #List

Possible solutions for STAN-0005

STAN-0006

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0006
Name Partial: base/cycle
Description Usage of partial function 'cycle' for lists
Severity Warning
Category #Partial #List

Possible solutions for STAN-0006

  • Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
  • Use explicit pattern-matching over lists

STAN-0007

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0007
Name Partial: base/genericIndex
Description Usage of partial function 'genericIndex' for lists
Severity Warning
Category #Partial #List

Possible solutions for STAN-0007

STAN-0008

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0008
Name Partial: base/fromJust
Description Usage of partial function 'fromJust' for 'Maybe'
Severity Warning
Category #Partial

Possible solutions for STAN-0008

  • Use explicit pattern-matching over Maybe
  • Use one of the standard functions: 'maybe', 'fromMaybe'

STAN-0009

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0009
Name Partial: base/read
Description Usage of partial function 'read' for parsing 'String'
Severity Warning
Category #Partial

Possible solutions for STAN-0009

  • Use 'readMaybe' or 'readEither' to handle failed parsing

STAN-0010

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0010
Name Partial: base/succ
Description Usage of partial function 'succ' for enumerable types
Severity Warning
Category #Partial

Possible solutions for STAN-0010

  • Use '(+ 1)' for integral types (but be aware of arithmetic overflow)
  • {Extra dependency} Use 'next' from 'Relude.Extra.Enum' in 'relude'

STAN-0011

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0011
Name Partial: base/pred
Description Usage of partial function 'pred' for enumerable types
Severity Warning
Category #Partial

Possible solutions for STAN-0011

  • Use '(- 1)' for integral types (but be aware of arithmetic overflow)
  • {Extra dependency} Use 'prev' from 'Relude.Extra.Enum' in 'relude'

STAN-0012

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0012
Name Partial: base/toEnum
Description Usage of partial function 'toEnum' for enumerable types
Severity Warning
Category #Partial

Possible solutions for STAN-0012

  • {Extra dependency} Use 'safeToEnum' from 'Relude.Extra.Enum' in 'relude'

STAN-0013

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0013
Name Partial: base/maximum
Description Usage of partial function 'maximum' for
Severity Warning
Category #Partial

Possible solutions for STAN-0013

STAN-0014

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0014
Name Partial: base/minimum
Description Usage of partial function 'minimum' for
Severity Warning
Category #Partial

Possible solutions for STAN-0014

STAN-0015

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0015
Name Partial: base/maximumBy
Description Usage of partial function 'maximumBy' for
Severity Warning
Category #Partial

Possible solutions for STAN-0015

STAN-0016

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0016
Name Partial: base/minimumBy
Description Usage of partial function 'minimumBy' for
Severity Warning
Category #Partial

Possible solutions for STAN-0016

STAN-0017

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0017
Name Partial: base/foldl1
Description Usage of partial function 'foldl1' for
Severity Warning
Category #Partial

Possible solutions for STAN-0017

STAN-0018

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0018
Name Partial: base/foldl1'
Description Usage of partial function 'foldl1'' for lists
Severity Warning
Category #Partial #List

Possible solutions for STAN-0018

  • Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
  • Use explicit pattern-matching over lists

STAN-0019

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0019
Name Partial: base/foldr1
Description Usage of partial function 'foldr1' for
Severity Warning
Category #Partial

Possible solutions for STAN-0019

STAN-0020

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0020
Name Partial: base/fromList
Description Usage of partial function 'fromList' for
Severity Warning
Category #Partial

Possible solutions for STAN-0020

STAN-0021

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0021
Name Partial: base/fromInteger
Description Usage of partial function 'fromInteger' for
Severity Warning
Category #Partial

Possible solutions for STAN-0021

STAN-0101

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0101
Name Infinite: base/reverse
Description Usage of the 'reverse' function that hangs on infinite lists
Severity PotentialBug
Category #Infinite #List

Possible solutions for STAN-0101

  • Don't use 'reverse' if you expect your function to work with infinite lists
  • {Extra dependency} Use the 'slist' library for fast and safe functions on infinite lists

STAN-0102

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0102
Name Infinite: base/isSuffixOf
Description Usage of the 'isSuffixOf' function that hangs on infinite lists
Severity PotentialBug
Category #Infinite #List

Possible solutions for STAN-0102

  • Don't use 'isSuffixOf' if you expect your function to work with infinite lists
  • {Extra dependency} Use the 'slist' library for fast and safe functions on infinite lists

STAN-0103

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0103
Name Infinite: base/length
Description Usage of the 'length' function that hangs on infinite lists
Severity PotentialBug
Category #Infinite #List

Possible solutions for STAN-0103

  • Don't use 'length' if you expect your function to work with infinite lists
  • {Extra dependency} Use the 'slist' library for fast and safe functions on infinite lists

STAN-0104

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0104
Name Infinite: base/genericLength
Description Usage of the 'genericLength' function that hangs on infinite lists
Severity PotentialBug
Category #Infinite #List

Possible solutions for STAN-0104

  • Don't use 'genericLength' if you expect your function to work with infinite lists
  • {Extra dependency} Use the 'slist' library for fast and safe functions on infinite lists

STAN-0105

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0105
Name Infinite: base/sum
Description Usage of the 'sum' function that hangs on infinite lists
Severity PotentialBug
Category #Infinite #List

Possible solutions for STAN-0105

  • Don't use 'sum' if you expect your function to work with infinite lists
  • {Extra dependency} Use the 'slist' library for fast and safe functions on infinite lists

STAN-0106

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0106
Name Infinite: base/product
Description Usage of the 'product' function that hangs on infinite lists
Severity PotentialBug
Category #Infinite #List

Possible solutions for STAN-0106

  • Don't use 'product' if you expect your function to work with infinite lists
  • {Extra dependency} Use the 'slist' library for fast and safe functions on infinite lists

STAN-0201

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0201
Name Anti-pattern: [0 .. length xs]
Description Creating a list with wrong number of indices
Severity PotentialBug
Category #AntiPattern

Possible solutions for STAN-0201

  • Replace '[0 .. length xs]' with '[0 .. length xs - 1]'
  • Use 'zip [0 ..] xs` to work with list of pairs: index and element

STAN-0202

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0202
Name Anti-pattern: foldl
Description Usage of space-leaking function 'foldl'
Severity Error
Category #SpaceLeak #AntiPattern

Possible solutions for STAN-0202

  • Replace 'foldl' with 'foldl''
  • Use 'foldr (flip . f)` instead of 'foldl f'

STAN-0203

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0203
Name Anti-pattern: Data.ByteString.Char8.pack
Description Usage of 'pack' function that doesn't handle Unicode characters
Severity Error
Category #AntiPattern

Possible solutions for STAN-0203

  • Convert to 'Text' and use 'encodeUtf8' from 'Data.Text.Encoding'
  • {Extra dependency} Use 'encodeUtf8' from 'relude'
  • {Extra dependency} Use the 'utf8-string' package

STAN-0204

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0204
Name Anti-pattern: HashMap size
Description Usage of 'size' or 'length' for 'HashMap' that runs in linear time
Severity Performance
Category #AntiPattern

Possible solutions for STAN-0204

  • {Extra dependency} Switch to 'Map' from 'containers'

STAN-0205

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0205
Name Anti-pattern: HashSet size
Description Usage of 'size' or 'length' for 'HashSet' that runs in linear time
Severity Performance
Category #AntiPattern

Possible solutions for STAN-0205

  • {Extra dependency} Switch to 'Set' from 'containers'

STAN-0206

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0206
Name Data types with non-strict fields
Description Defining lazy fields in data types can lead to unexpected space leaks
Severity Performance
Category #SpaceLeak #Syntax

Possible solutions for STAN-0206

  • Add '!' before the type, e.g. !Int or !(Maybe Bool)
  • Enable the 'StrictData' extension: {-# LANGUAGE StrictData #-}

STAN-0207

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0207
Name Anti-pattern: Foldable methods on possibly error-prone structures
Description Usage of Foldable methods on (,), Maybe, Either
Severity PotentialBug
Category #AntiPattern

Possible solutions for STAN-0207

  • Use more explicit functions with specific monomorphic types

STAN-0208

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0208
Name Anti-pattern: Slow 'length' for Text
Description Usage of 'length' for 'Text' that runs in linear time
Severity Performance
Category #AntiPattern

Possible solutions for STAN-0208

  • {Extra dependency} Switch to 'ByteString' from 'bytesting'

STAN-0209

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0209
Name Anti-pattern: Slow 'nub' for lists
Description Usage of 'nub' on lists that runs in quadratic time
Severity Performance
Category #AntiPattern

Possible solutions for STAN-0209

  • {Extra dependency} Switch list to 'Set' from 'containers'
  • {Extra dependency} Use 'ordNub/hashNub/sortNub/unstableNub' from 'relude'
  • {Extra dependency} Use 'nubOrd' from 'containers'
  • {Extra dependency} Use 'nubOrd' from 'extra'

STAN-0210

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0210
Name Anti-pattern: Slow 'for_' on ranges
Description Usage of 'for_' or 'forM_' on numerical ranges is slow
Severity Performance
Category #AntiPattern

Possible solutions for STAN-0210

  • {Extra dependency} Use 'loop' library for fast monadic looping

STAN-0211

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0211
Name Anti-pattern: '</>' for URLs
Description Usage of '</>' for URLs results in the errors on Windows
Severity Error
Category #AntiPattern

Possible solutions for STAN-0211

  • {Extra dependency} Use type-safe library for URLs
  • Concatenate URLs with slashes '/'

STAN-0212

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0212
Name Anti-pattern: unsafe functions
Description Usage of unsafe functions breaks referential transparency
Severity Error
Category #Unsafe #AntiPattern

Possible solutions for STAN-0212

  • Remove 'undefined' or at least replace with 'error' to give better error messages
  • Replace 'unsafeCoerce' with 'coerce'
  • Rewrite the code to avoid using 'unsafePerformIO' and other unsafe IO functions

STAN-0213

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0213
Name Anti-pattern: Pattern matching on '_'
Description Pattern matching on '_' for sum types can create maintainability issues
Severity Warning
Category #AntiPattern

Possible solutions for STAN-0213

  • Pattern match on each constructor explicitly
  • Add meaningful names to holes, e.g. '_anyOtherFailure'

STAN-0214

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0214
Name Anti-pattern: use 'compare'
Description Usage of multiple comparison operators instead of single 'compare'
Severity Performance
Category #AntiPattern

Possible solutions for STAN-0214

  • Rewrite code to use single 'compare' instead of many comparison operators

STAN-0215

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0215
Name Anti-pattern: Slashes in paths
Description Usage of '/' or '' in paths results in the errors on different operation systems
Severity Error
Category #AntiPattern

Possible solutions for STAN-0215

  • {Extra dependency} Use '</>' operator from 'filepath'

STAN-0301

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0301
Name Missing fixity declaration for operator
Description Using the implicit default fixity for operator: infixl 9
Severity Style
Category #Syntax

Possible solutions for STAN-0301

  • Add 'infix[l|r]' declaration to the operator with explicit precedence

STAN-0302

[Back to the Table of all Inspections] ↑

Property Value
ID STAN-0302
Name Big tuples
Description Using tuples of big size (>= 4) can decrease code readability
Severity Style
Category #AntiPattern #Syntax

Possible solutions for STAN-0302

  • Consider defining and using a custom data type to improve code comprehension
Clone this wiki locally