Add NoUnoptimizedRecursion rule, with a few known cases that might be possible to fix in the future.

This commit is contained in:
Dillon Kearns 2021-06-03 16:09:20 -07:00
parent f22abc904e
commit 4907f9c674
4 changed files with 7 additions and 0 deletions

View File

@ -10,6 +10,7 @@
"elm/json": "1.1.3",
"elm/project-metadata-utils": "1.0.1",
"jfmengels/elm-review": "2.4.0",
"jfmengels/elm-review-performance": "1.0.0",
"jfmengels/elm-review-unused": "1.1.8",
"sparksp/elm-review-imports": "1.0.0",
"stil4m/elm-syntax": "7.2.3"

View File

@ -13,6 +13,7 @@ when inside the directory containing this file.
import NoInconsistentAliases
import NoModuleOnExposedNames
import NoUnoptimizedRecursion
import NoUnused.CustomTypeConstructorArgs
import NoUnused.CustomTypeConstructors
import NoUnused.Dependencies
@ -43,6 +44,8 @@ config =
|> NoInconsistentAliases.noMissingAliases
|> NoInconsistentAliases.rule
, NoModuleOnExposedNames.rule
, NoUnoptimizedRecursion.rule (NoUnoptimizedRecursion.optOutWithComment "known-unoptimized-recursion")
|> Rule.ignoreErrorsForDirectories [ "tests", "src/ElmHtml" ]
]
|> List.map
(\rule ->

View File

@ -136,6 +136,7 @@ A common use for this is to map your data into your elm-pages view:
-}
map : (a -> b) -> DataSource a -> DataSource b
map fn requestInfo =
-- elm-review: known-unoptimized-recursion
case requestInfo of
RequestError error ->
RequestError error
@ -222,6 +223,7 @@ combine =
-}
map2 : (a -> b -> c) -> DataSource a -> DataSource b -> DataSource c
map2 fn request1 request2 =
-- elm-review: known-unoptimized-recursion
case ( request1, request2 ) of
( RequestError error, _ ) ->
RequestError error

View File

@ -88,6 +88,7 @@ toString list =
toString_ : Text -> String
toString_ textValue =
-- elm-review: known-unoptimized-recursion
case textValue of
RawText content ->
content