Adddress review errors.

This commit is contained in:
Dillon Kearns 2021-06-03 17:17:46 -07:00
parent ee874f3ba0
commit e239931ff4
7 changed files with 19 additions and 17 deletions

View File

@ -43,8 +43,11 @@ config =
--, NoUnused.Exports.rule
--, NoUnused.Modules.rule
-- |> Rule.ignoreErrorsForFiles [ "src/StructuredData.elm" ]
--NoUnused.Parameters.rule
NoUnused.Patterns.rule
NoUnused.Parameters.rule
|> Rule.ignoreErrorsForFiles
[ "src/HtmlPrinter.elm" -- magic argument in the HtmlPrinter
]
, NoUnused.Patterns.rule
, NoUnused.Variables.rule
|> Rule.ignoreErrorsForFiles
[ "src/DataSource/Glob.elm"

View File

@ -41,7 +41,7 @@ withRoutesNew :
(constructor -> List (List String))
-> Handler a constructor
-> List String
withRoutesNew buildUrls (Handler pattern handler toString constructor) =
withRoutesNew buildUrls (Handler _ _ toString constructor) =
buildUrls (constructor [])
|> List.map toString
@ -64,7 +64,7 @@ singleRoute handler =
{-| -}
buildTimeRoutes : (constructor -> DataSource (List (List String))) -> Handler (DataSource Response) constructor -> Done Response
buildTimeRoutes buildUrls ((Handler pattern handler toString constructor) as fullHandler) =
buildTimeRoutes buildUrls ((Handler pattern _ toString constructor) as fullHandler) =
let
buildTimeRoutes__ =
buildUrls (constructor [])
@ -112,7 +112,7 @@ buildTimeRoutes buildUrls ((Handler pattern handler toString constructor) as ful
{-| -}
pathToMatches : String -> Handler a constructor -> List String
pathToMatches path (Handler pattern handler toString constructor) =
pathToMatches path (Handler pattern _ _ _) =
Regex.find
(Regex.fromString pattern
|> Maybe.withDefault Regex.never
@ -124,14 +124,14 @@ pathToMatches path (Handler pattern handler toString constructor) =
{-| -}
withRoutes : (constructor -> List (List String)) -> Handler a constructor -> List String
withRoutes buildUrls (Handler pattern handler toString constructor) =
withRoutes buildUrls (Handler _ _ toString constructor) =
buildUrls (constructor [])
|> List.map toString
{-| -}
tryMatch : String -> Handler response constructor -> Maybe response
tryMatch path (Handler pattern handler toString constructor) =
tryMatch path (Handler pattern handler _ _) =
let
matches =
Regex.find

View File

@ -40,7 +40,7 @@ run rawInput (Glob pattern regex applyCapture) =
{-| -}
toPattern : Glob a -> String
toPattern (Glob pattern regex applyCapture) =
toPattern (Glob pattern _ _) =
pattern

View File

@ -9,10 +9,10 @@ type OptimizedDecoder a
jd : OptimizedDecoder a -> Json.Decode.Decoder a
jd (OptimizedDecoder jd_ jde_) =
jd (OptimizedDecoder jd_ _) =
jd_
jde : OptimizedDecoder a -> Json.Decode.Exploration.Decoder a
jde (OptimizedDecoder jd_ jde_) =
jde (OptimizedDecoder _ jde_) =
jde_

View File

@ -107,7 +107,7 @@ errorToString =
But if you want to re-use your decoder somewhere else, it may be useful to turn it into a plain `elm/json` decoder.
-}
decoder : Decoder a -> JD.Decoder a
decoder (OptimizedDecoder jd jde) =
decoder (OptimizedDecoder jd _) =
jd
@ -117,7 +117,7 @@ This will directly call the raw `elm/json` decoder that is stored under the hood
-}
decodeString : Decoder a -> String -> Result Error a
decodeString (OptimizedDecoder jd jde) =
decodeString (OptimizedDecoder jd _) =
JD.decodeString jd

View File

@ -399,11 +399,11 @@ initLegacy renderRequest { secrets, mode, staticHttpCache } contentCache config
(config.handleRoute serverRequestPayload.frontmatter)
RenderRequest.Api ( path, apiRequest ) ->
StaticResponses.renderApiRequest config
StaticResponses.renderApiRequest
(apiRequest.matchesToResponse path)
RenderRequest.NotFound ->
StaticResponses.renderApiRequest config
StaticResponses.renderApiRequest
(DataSource.succeed [])
RenderRequest.FullBuild ->

View File

@ -123,10 +123,9 @@ renderSingleRoute config pathAndRoute request cliData =
renderApiRequest :
config
-> DataSource response
DataSource response
-> StaticResponses
renderApiRequest config request =
renderApiRequest request =
ApiRequest
(NotFetched
(request |> DataSource.map (\_ -> ()))