This is the Haskell Static Analysis report generated by Stan
Stan Info
In this section, you can find the general information about the used Stan tool, compile-time and run-time environment variables and settings, including build information, system data and execution configurations.
Stan Version | |
Version | 0.0.1.0 |
Git Revision | dcbc8682a964ae6f642ae37adbd46f6545d39aa6 |
Release Date | Fri Jul 29 13:18:20 2022 +0100 |
System Info | |
Operating System | linux |
Architecture | x86_64 |
Compiler | ghc |
Compiler Version | 8.10 |
Environment | |
Environment Variables | STAN_USE_DEFAULT_CONFIG=True |
TOML configuration files | /home/kamil-adam/git/helvm/heltc/.stan.toml |
CLI arguments | -s --hide-solution report |
Project Info
Information about the analysed project
Project name | heltc |
Cabal Files | heltc.cabal |
HIE Files Directory | .hie |
Files Number | 77 |
Analysis Info
Summary stats from the static analysis
Modules | 77 |
LoC | 2792 |
Extensions | 29 |
SafeHaskell Extensions | 0 |
Available inspections | 44 |
Checked inspections | 44 |
Found Observations | 5 |
Ignored Observations | 0 |
Static Analysis Summary
Here you can find the overall conclusion based on the various metadata and gathered information during the work of Stan on this project.
Project health: 95.45%
This number was calculated based on the total number of used inspections and the number of triggered inspections in the project. The calculated number also defines the overall project health status.The project has medium health
Stan discovered several potential issues in the project. Nice job, the overall project quality is good. And you can easily make it even better!Watch out for STAN-0001
By the result of Stan analysis, the most common inspection for this project is STAN-0001Vulnerable module: HelVM.HelTC.Calculators.Legacy.Parsers.LambdaParser
TheHelVM.HelTC.Calculators.Legacy.Parsers.LambdaParser
module is the most vulnerable one in the project, as it got the most number of observationsPopular category: Partial
- Partial
Severity: Warning
The highest severity of found observations is Warning
Observations
Based on the analysis results, Stan found several areas for improvement in the analysed files. In Stan terminology, we call these findings Observations. Below you can see the more detailed information about each observation, and find the possible ways to fix them for your project.
📄 hs/src/HelVM/HelTC/Calculators/Legacy/Parsers/LambdaParser.hs
Module HelVM.HelTC.Calculators.Legacy.Parsers.LambdaParser
Lines of Code 51 - EmptyDataDecls
- ExistentialQuantification
- FlexibleContexts
- FlexibleInstances
- FunctionalDependencies
- GADTs
- GeneralizedNewtypeDeriving
- InstanceSigs
- KindSignatures
- LambdaCase
- MultiParamTypeClasses
- MultiWayIf
- NamedFieldPuns
- OverloadedStrings
- PartialTypeSignatures
- PatternGuards
- PolyKinds
- RankNTypes
- RecordWildCards
- ScopedTypeVariables
- StandaloneDeriving
- TupleSections
- TypeFamilies
- TypeSynonymInstances
- ViewPatterns
- TypeOperators
- DerivingStrategies
- ConstraintKinds
- StrictData
Observations
ID OBS-STAN-0001-he9JRt-12:27 Severity Warning Description Usage of partial function 'head' for lists Inspection ID STAN-0001 Category - Partial
- List
File hs/src/HelVM/HelTC/Calculators/Legacy/Parsers/LambdaParser.hs 11 ┃ 12 ┃ parseLambda = fst . fst . Unsafe.head . (lambdaParser >*> eof) . lexer . toString 13 ┃ ^^^^^^^^^^^
Possible solutions
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
ID OBS-STAN-0001-he9JRt-33:31 Severity Warning Description Usage of partial function 'head' for lists Inspection ID STAN-0001 Category - Partial
- List
File hs/src/HelVM/HelTC/Calculators/Legacy/Parsers/LambdaParser.hs 32 ┃ 33 ┃ atomParser = (spot (isLower . Unsafe.head) `build` (Var . toText)) `alt` parensParser 34 ┃ ^^^^^^^^^^^
Possible solutions
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
ID OBS-STAN-0001-he9JRt-39:41 Severity Warning Description Usage of partial function 'head' for lists Inspection ID STAN-0001 Category - Partial
- List
File hs/src/HelVM/HelTC/Calculators/Legacy/Parsers/LambdaParser.hs 38 ┃ 39 ┃ paramsParser = list1 $ spot $ isLower . Unsafe.head 40 ┃ ^^^^^^^^^^^
Possible solutions
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
📄 hs/src/HelVM/HelTC/Calculators/Legacy/Parsers/ZotParser.hs
Module HelVM.HelTC.Calculators.Legacy.Parsers.ZotParser
Lines of Code 43 - EmptyDataDecls
- ExistentialQuantification
- FlexibleContexts
- FlexibleInstances
- FunctionalDependencies
- GADTs
- GeneralizedNewtypeDeriving
- InstanceSigs
- KindSignatures
- LambdaCase
- MultiParamTypeClasses
- MultiWayIf
- NamedFieldPuns
- OverloadedStrings
- PartialTypeSignatures
- PatternGuards
- PolyKinds
- RankNTypes
- RecordWildCards
- ScopedTypeVariables
- StandaloneDeriving
- TupleSections
- TypeFamilies
- TypeSynonymInstances
- ViewPatterns
- TypeOperators
- DerivingStrategies
- ConstraintKinds
- StrictData
Observations
ID OBS-STAN-0001-qOV6W1-21:26 Severity Warning Description Usage of partial function 'head' for lists Inspection ID STAN-0001 Category - Partial
- List
File hs/src/HelVM/HelTC/Calculators/Legacy/Parsers/ZotParser.hs 20 ┃ 21 ┃ convert = toText . fst . Unsafe.head . (zotParser >*> eof `build` fst) . toString . filterNonSeparator 22 ┃ ^^^^^^^^^^^
Possible solutions
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
📄 hs/src/HelVM/HelTC/Calculators/Legacy/Reducers/FromSki.hs
Module HelVM.HelTC.Calculators.Legacy.Reducers.FromSki
Lines of Code 56 - EmptyDataDecls
- ExistentialQuantification
- FlexibleContexts
- FlexibleInstances
- FunctionalDependencies
- GADTs
- GeneralizedNewtypeDeriving
- InstanceSigs
- KindSignatures
- LambdaCase
- MultiParamTypeClasses
- MultiWayIf
- NamedFieldPuns
- OverloadedStrings
- PartialTypeSignatures
- PatternGuards
- PolyKinds
- RankNTypes
- RecordWildCards
- ScopedTypeVariables
- StandaloneDeriving
- TupleSections
- TypeFamilies
- TypeSynonymInstances
- ViewPatterns
- TypeOperators
- DerivingStrategies
- ConstraintKinds
- StrictData
Observations
ID OBS-STAN-0016-HMLSun-11:25 Severity Warning Description Usage of partial function 'minimumBy' for Inspection ID STAN-0016 Category - Partial
File hs/src/HelVM/HelTC/Calculators/Legacy/Reducers/FromSki.hs 10 ┃ 11 ┃ skiToLambda = betaSki . minimumBy (comparing size) . take 15 . iterate betaReduction 12 ┃ ^^^^^^^^^
Configurations
This section describes the final Stan configuration that was used on the project and explains how this result was assembled. Stan runtime settings have many parts, and each of them can come from different configuration sources. Stan is using Environment variables, TOML configuration file and CLI arguments to get the final results. If some option is specified through the multiple sources, the most prioritized one is used.
Action | Filter | Scope |
---|
Configuration Process Information
Information and warnings that were gathered during the configuration assemble process. This helps to understand how different parts of the configurations were retrieved.
- No TOML value is specified for key: check
- No CLI option specified for: checks
- configChecks is set through the source: TOML
- No TOML value is specified for key: remove
- No CLI option specified for: remove
- configRemoved is set through the source: TOML
- No TOML value is specified for key: ignore
- No CLI option specified for: ignore
- configIgnored is set through the source: TOML
Report Explained
Inspections
List of Inspections used for analysing the project
Inspection STAN-0001
Partial: base/head
Usage of partial function 'head' for lists
- Partial
- List
Possible solutions
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
Inspection STAN-0002
Partial: base/tail
Usage of partial function 'tail' for lists
- Partial
- List
Possible solutions
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
Inspection STAN-0003
Partial: base/init
Usage of partial function 'init' for lists
- Partial
- List
Possible solutions
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
Inspection STAN-0004
Partial: base/last
Usage of partial function 'last' for lists
- Partial
- List
Possible solutions
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
Inspection STAN-0005
Partial: base/!!
Usage of partial function '!!' for lists
- Partial
- List
Inspection STAN-0006
Partial: base/cycle
Usage of partial function 'cycle' for lists
- Partial
- List
Possible solutions
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
Inspection STAN-0007
Partial: base/genericIndex
Usage of partial function 'genericIndex' for lists
- Partial
- List
Inspection STAN-0008
Partial: base/fromJust
Usage of partial function 'fromJust' for 'Maybe'
- Partial
Possible solutions
- Use explicit pattern-matching over Maybe
- Use one of the standard functions: 'maybe', 'fromMaybe'
Inspection STAN-0009
Partial: base/read
Usage of partial function 'read' for parsing 'String'
- Partial
Possible solutions
- Use 'readMaybe' or 'readEither' to handle failed parsing
Inspection STAN-0010
Partial: base/succ
Usage of partial function 'succ' for enumerable types
- Partial
Possible solutions
- Use '(+ 1)' for integral types (but be aware of arithmetic overflow)
- {Extra dependency} Use 'next' from 'Relude.Extra.Enum' in 'relude'
Inspection STAN-0011
Partial: base/pred
Usage of partial function 'pred' for enumerable types
- Partial
Possible solutions
- Use '(- 1)' for integral types (but be aware of arithmetic overflow)
- {Extra dependency} Use 'prev' from 'Relude.Extra.Enum' in 'relude'
Inspection STAN-0012
Partial: base/toEnum
Usage of partial function 'toEnum' for enumerable types
- Partial
Possible solutions
- {Extra dependency} Use 'safeToEnum' from 'Relude.Extra.Enum' in 'relude'
Inspection STAN-0013
Partial: base/maximum
Usage of partial function 'maximum' for
- Partial
Inspection STAN-0014
Partial: base/minimum
Usage of partial function 'minimum' for
- Partial
Inspection STAN-0015
Partial: base/maximumBy
Usage of partial function 'maximumBy' for
- Partial
Inspection STAN-0016
Partial: base/minimumBy
Usage of partial function 'minimumBy' for
- Partial
Inspection STAN-0017
Partial: base/foldl1
Usage of partial function 'foldl1' for
- Partial
Inspection STAN-0018
Partial: base/foldl1'
Usage of partial function 'foldl1'' for lists
- Partial
- List
Possible solutions
- Replace list with 'NonEmpty' from 'Data.List.NonEmpty'
- Use explicit pattern-matching over lists
Inspection STAN-0019
Partial: base/foldr1
Usage of partial function 'foldr1' for
- Partial
Inspection STAN-0020
Partial: base/fromList
Usage of partial function 'fromList' for
- Partial
Inspection STAN-0021
Partial: base/fromInteger
Usage of partial function 'fromInteger' for
- Partial
Inspection STAN-0101
Infinite: base/reverse
Usage of the 'reverse' function that hangs on infinite lists
- Infinite
- List
Possible solutions
- 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
Inspection STAN-0102
Infinite: base/isSuffixOf
Usage of the 'isSuffixOf' function that hangs on infinite lists
- Infinite
- List
Possible solutions
- 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
Inspection STAN-0103
Infinite: base/length
Usage of the 'length' function that hangs on infinite lists
- Infinite
- List
Possible solutions
- 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
Inspection STAN-0104
Infinite: base/genericLength
Usage of the 'genericLength' function that hangs on infinite lists
- Infinite
- List
Possible solutions
- 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
Inspection STAN-0105
Infinite: base/sum
Usage of the 'sum' function that hangs on infinite lists
- Infinite
- List
Possible solutions
- 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
Inspection STAN-0106
Infinite: base/product
Usage of the 'product' function that hangs on infinite lists
- Infinite
- List
Possible solutions
- 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
Inspection STAN-0201
Anti-pattern: [0 .. length xs]
Creating a list with wrong number of indices
- AntiPattern
Possible solutions
- Replace '[0 .. length xs]' with '[0 .. length xs - 1]'
- Use 'zip [0 ..] xs` to work with list of pairs: index and element
Inspection STAN-0202
Anti-pattern: foldl
Usage of space-leaking function 'foldl'
- SpaceLeak
- AntiPattern
Possible solutions
- Replace 'foldl' with 'foldl''
- Use 'foldr (flip . f)` instead of 'foldl f'
Inspection STAN-0203
Anti-pattern: Data.ByteString.Char8.pack
Usage of 'pack' function that doesn't handle Unicode characters
- AntiPattern
Possible solutions
- Convert to 'Text' and use 'encodeUtf8' from 'Data.Text.Encoding'
- {Extra dependency} Use 'encodeUtf8' from 'relude'
- {Extra dependency} Use the 'utf8-string' package
Inspection STAN-0204
Anti-pattern: HashMap size
Usage of 'size' or 'length' for 'HashMap' that runs in linear time
- AntiPattern
Possible solutions
- {Extra dependency} Switch to 'Map' from 'containers'
Inspection STAN-0205
Anti-pattern: HashSet size
Usage of 'size' or 'length' for 'HashSet' that runs in linear time
- AntiPattern
Possible solutions
- {Extra dependency} Switch to 'Set' from 'containers'
Inspection STAN-0206
Data types with non-strict fields
Defining lazy fields in data types can lead to unexpected space leaks
- SpaceLeak
- Syntax
Possible solutions
- Add '!' before the type, e.g. !Int or !(Maybe Bool)
- Enable the 'StrictData' extension: {-# LANGUAGE StrictData #-}
Inspection STAN-0207
Anti-pattern: Foldable methods on possibly error-prone structures
Usage of Foldable methods on (,), Maybe, Either
- AntiPattern
Possible solutions
- Use more explicit functions with specific monomorphic types
Inspection STAN-0208
Anti-pattern: Slow 'length' for Text
Usage of 'length' for 'Text' that runs in linear time
- AntiPattern
Possible solutions
- {Extra dependency} Switch to 'ByteString' from 'bytestring'
Inspection STAN-0209
Anti-pattern: Slow 'nub' for lists
Usage of 'nub' on lists that runs in quadratic time
- AntiPattern
Possible solutions
- {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'
Inspection STAN-0210
Anti-pattern: Slow 'for_' on ranges
Usage of 'for_' or 'forM_' on numerical ranges is slow
- AntiPattern
Possible solutions
- {Extra dependency} Use 'loop' library for fast monadic looping
Inspection STAN-0211
Anti-pattern: '</>' for URLs
Usage of '</>' for URLs results in the errors on Windows
- AntiPattern
Possible solutions
- {Extra dependency} Use type-safe library for URLs
- Concatenate URLs with slashes '/'
Inspection STAN-0212
Anti-pattern: unsafe functions
Usage of unsafe functions breaks referential transparency
- Unsafe
- AntiPattern
Possible solutions
- 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
Inspection STAN-0213
Anti-pattern: Pattern matching on '_'
Pattern matching on '_' for sum types can create maintainability issues
- AntiPattern
Possible solutions
- Pattern match on each constructor explicitly
- Add meaningful names to holes, e.g. '_anyOtherFailure'
Inspection STAN-0214
Anti-pattern: use 'compare'
Usage of multiple comparison operators instead of single 'compare'
- AntiPattern
Possible solutions
- Rewrite code to use single 'compare' instead of many comparison operators
Inspection STAN-0215
Anti-pattern: Slashes in paths
Usage of '/' or '\' in paths results in the errors on different operation systems
- AntiPattern
Possible solutions
- {Extra dependency} Use '</>' operator from 'filepath'
Inspection STAN-0301
Missing fixity declaration for operator
Using the implicit default fixity for operator: infixl 9
- Syntax
Possible solutions
- Add 'infix[l|r]' declaration to the operator with explicit precedence
Inspection STAN-0302
Big tuples
Using tuples of big size (>= 4) can decrease code readability
- AntiPattern
- Syntax
Possible solutions
- Consider defining and using a custom data type to improve code comprehension
Severity
We are using the following severity system to indicate the observation level
Severity | Description |
---|---|
Style | Code style issues. Usually harmless. |
Performance | Serious defects that could cause slowness and space leaking. |
PotentialBug | Human errors in code. |
Warning | Potential runtime errors on some inputs. |
Error | Dangerous behaviour. |