Remove name from project visitor

This commit is contained in:
Jeroen Engels 2020-06-26 00:19:58 +02:00
parent 0b4de3ab1e
commit 0598301507
2 changed files with 7 additions and 8 deletions

View File

@ -63,6 +63,8 @@ type ProjectRuleSchema schemaState projectContext moduleContext
-- TODO Jeroen Only allow to set it if there is a folder, but not several times
, traversalType : TraversalType
-- TODO Jeroen Only allow to set it if there is a folder and module visitors?
, finalEvaluationFns : List (projectContext -> List (Error {}))
}
@ -207,8 +209,6 @@ fromModuleRuleSchema ((ModuleRuleSchema schema) as moduleVisitor) =
, moduleVisitors = [ removeExtensibleRecordTypeVariable (always moduleVisitor) ]
, moduleContextCreator = Just (Context.init identity)
, folder = Nothing
-- TODO Jeroen Only allow to set it if there is a folder, but not several times
, traversalType = AllModulesInParallel
, finalEvaluationFns = []
}
@ -392,7 +392,7 @@ fromProjectRuleSchema : ProjectRuleSchema { schemaState | hasAtLeastOneVisitor :
fromProjectRuleSchema ((ProjectRuleSchema schema) as projectRuleSchema) =
Rule schema.name
Exceptions.init
(Review.Visitor.run (fromProjectRuleSchemaToRunnableProjectVisitor projectRuleSchema) Nothing)
(Review.Visitor.run schema.name (fromProjectRuleSchemaToRunnableProjectVisitor projectRuleSchema) Nothing)
fromProjectRuleSchemaToRunnableProjectVisitor : ProjectRuleSchema schemaState projectContext moduleContext -> Review.Visitor.RunnableProjectVisitor projectContext moduleContext
@ -412,7 +412,6 @@ fromProjectRuleSchemaToRunnableProjectVisitor (ProjectRuleSchema schema) =
Review.Visitor.TraverseImportedModulesFirst folder
( ImportedModulesFirst, Nothing ) ->
-- TODO Jeroen Only allow to set it if there is a folder, but not several times
Review.Visitor.TraverseAllModulesInParallel Nothing
, finalEvaluationFns = List.reverse schema.finalEvaluationFns
}

View File

@ -88,8 +88,8 @@ type alias Folder projectContext moduleContext =
}
run : RunnableProjectVisitor projectContext moduleContext -> Maybe (ProjectRuleCache projectContext) -> Exceptions -> Project -> List (Graph.NodeContext ModuleName ()) -> ( List (Error {}), Rule )
run projectVisitor maybePreviousCache exceptions project nodeContexts =
run : String -> RunnableProjectVisitor projectContext moduleContext -> Maybe (ProjectRuleCache projectContext) -> Exceptions -> Project -> List (Graph.NodeContext ModuleName ()) -> ( List (Error {}), Rule )
run name projectVisitor maybePreviousCache exceptions project nodeContexts =
let
cacheWithInitialContext : ProjectRuleCache projectContext
cacheWithInitialContext =
@ -173,8 +173,8 @@ run projectVisitor maybePreviousCache exceptions project nodeContexts =
errorsFromCache newCache
|> Exceptions.apply exceptions (accessInternalError >> .filePath)
in
( List.map (setRuleName projectVisitor.name) errors
, Rule projectVisitor.name exceptions (run projectVisitor (Just newCache))
( List.map (setRuleName name) errors
, Rule name exceptions (run name projectVisitor (Just newCache))
)