-
-
Notifications
You must be signed in to change notification settings - Fork 48
All Inspections
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
- STAN-0001
- STAN-0002
- STAN-0003
- STAN-0004
- STAN-0005
- STAN-0006
- STAN-0007
- STAN-0008
- STAN-0009
- STAN-0010
- STAN-0011
- STAN-0012
- STAN-0013
- STAN-0014
- STAN-0015
- STAN-0016
- STAN-0017
- STAN-0018
- STAN-0019
- STAN-0020
- STAN-0021
- STAN-0101
- STAN-0102
- STAN-0103
- STAN-0104
- STAN-0105
- STAN-0106
- STAN-0201
- STAN-0202
- STAN-0203
- STAN-0204
- STAN-0205
- STAN-0206
- STAN-0207
- STAN-0208
- STAN-0209
- STAN-0210
- STAN-0211
- STAN-0212
- STAN-0213
- STAN-0214
- STAN-0215
- STAN-0301
- STAN-0302
[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 |
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
[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 |
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
[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 |
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
[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 |
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
[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 |
[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 |
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
[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 |
[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 |
- Use explicit pattern-matching over Maybe
- Use one of the standard functions: 'maybe', 'fromMaybe'
[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 |
- Use 'readMaybe' or 'readEither' to handle failed parsing
[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 |
- Use '(+ 1)' for integral types (but be aware of arithmetic overflow)
- {Extra dependency} Use 'next' from 'Relude.Extra.Enum' in 'relude'
[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 |
- Use '(- 1)' for integral types (but be aware of arithmetic overflow)
- {Extra dependency} Use 'prev' from 'Relude.Extra.Enum' in 'relude'
[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 |
- {Extra dependency} Use 'safeToEnum' from 'Relude.Extra.Enum' in 'relude'
[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 |
[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 |
[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 |
[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 |
[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 |
[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 |
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
[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 |
[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 |
[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 |
[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 |
- 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
[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 |
- 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
[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 |
- 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
[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 |
- 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
[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 |
- 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
[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 |
- 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
[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 |
- Replace '[0 .. length xs]' with '[0 .. length xs - 1]'
- Use 'zip [0 ..] xs` to work with list of pairs: index and element
[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 |
- Replace 'foldl' with 'foldl''
- Use 'foldr (flip . f)` instead of 'foldl f'
[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 |
- Convert to 'Text' and use 'encodeUtf8' from 'Data.Text.Encoding'
- {Extra dependency} Use 'encodeUtf8' from 'relude'
- {Extra dependency} Use the 'utf8-string' package
[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 |
- {Extra dependency} Switch to 'Map' from 'containers'
[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 |
- {Extra dependency} Switch to 'Set' from 'containers'
[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 |
- Add '!' before the type, e.g. !Int or !(Maybe Bool)
- Enable the 'StrictData' extension: {-# LANGUAGE StrictData #-}
[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 |
- Use more explicit functions with specific monomorphic types
[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 |
- {Extra dependency} Switch to 'ByteString' from 'bytesting'
[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 |
- {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'
[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 |
- {Extra dependency} Use 'loop' library for fast monadic looping
[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 |
- {Extra dependency} Use type-safe library for URLs
- Concatenate URLs with slashes '/'
[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 |
- 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
[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 |
- Pattern match on each constructor explicitly
- Add meaningful names to holes, e.g. '_anyOtherFailure'
[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 |
- Rewrite code to use single 'compare' instead of many comparison operators
[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 |
- {Extra dependency} Use '</>' operator from 'filepath'
[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 |
- Add 'infix[l|r]' declaration to the operator with explicit precedence
[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 |
- Consider defining and using a custom data type to improve code comprehension