Add files to RequestedData

This commit is contained in:
Jeroen Engels 2023-05-31 10:47:18 +02:00
parent 0e63394168
commit 2239a05643
2 changed files with 11 additions and 1 deletions

View File

@ -1,4 +1,4 @@
module Review.RequestedData exposing (RequestedData(..), combine, combineJust, none)
module Review.RequestedData exposing (RequestedData(..), combine, combineJust, none, withFiles)
type RequestedData
@ -35,6 +35,15 @@ combine maybeA maybeB =
a
withFiles : List String -> RequestedData -> RequestedData
withFiles files ((RequestedData requested) as untouched) =
if List.isEmpty files then
untouched
else
RequestedData { requested | files = files }
combineJust : RequestedData -> RequestedData -> RequestedData
combineJust (RequestedData a) (RequestedData b) =
RequestedData

View File

@ -1263,6 +1263,7 @@ fromProjectRuleSchema (ProjectRuleSchema schema) =
RequestedData.combine
(Maybe.map requestedDataFromContextCreator schema.moduleContextCreator)
(Maybe.map (.fromModuleToProject >> requestedDataFromContextCreator) schema.folder)
|> RequestedData.withFiles schema.arbitraryFileRequest
, providesFixes = schema.providesFixes
, ruleProjectVisitor =
Ok