Turn extra files into a Dict String String

This commit is contained in:
Jeroen Engels 2024-04-16 22:55:00 +02:00
parent c2440e5644
commit 757ebb6b5e
2 changed files with 6 additions and 8 deletions

View File

@ -334,11 +334,11 @@ addExtraFiles files (Internal.Project project) =
}
{-| Get the list of extra files in the project.
{-| Get the extra files in the project.
-}
extraFiles : Project -> List { path : String, content : String }
extraFiles : Project -> Dict String String
extraFiles (Internal.Project project) =
List.map Tuple.first project.extraFiles
project.extraFiles2
{-| Add a dependency to the project. These will be available for rules to make

View File

@ -547,18 +547,16 @@ readmeRunResult errors project =
extraFileRunResult : List ReviewError -> Project -> List SuccessfulRunResult
extraFileRunResult errors project =
let
extraFilePaths : Dict String { path : String, content : String }
extraFilePaths : Dict String String
extraFilePaths =
Project.extraFiles project
|> List.map (\file -> ( file.path, file ))
|> Dict.fromList
in
Dict.foldl
(\path errorsForFile acc ->
case Dict.get path extraFilePaths of
Just file ->
Just content ->
{ moduleName = path
, inspector = codeInspectorForSource False file.content
, inspector = codeInspectorForSource False content
, errors = errorsForFile
}
:: acc