From 13bed263d0c6b2e720a3ba640e4a2846df029231 Mon Sep 17 00:00:00 2001 From: Jeroen Engels Date: Mon, 2 Mar 2020 22:54:22 +0100 Subject: [PATCH] Rename withProjectDependenciesVisitor to withDependenciesProjectVisitor --- src/NoInvalidLicense.elm | 2 +- src/NoUnusedDependencies.elm | 2 +- src/Review/Rule.elm | 14 +++++++------- src/Scope2.elm | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/NoInvalidLicense.elm b/src/NoInvalidLicense.elm index 9b07960a..9b7115f2 100644 --- a/src/NoInvalidLicense.elm +++ b/src/NoInvalidLicense.elm @@ -41,7 +41,7 @@ rule configuration = , foldProjectContexts = foldProjectContexts } |> Rule.withElmJsonProjectVisitor elmJsonVisitor - |> Rule.withProjectDependenciesVisitor dependenciesVisitor + |> Rule.withDependenciesProjectVisitor dependenciesVisitor |> Rule.withFinalProjectEvaluation (finalEvaluationForProject configuration) |> Rule.fromProjectRuleSchema diff --git a/src/NoUnusedDependencies.elm b/src/NoUnusedDependencies.elm index a05c36b3..7627ff6b 100644 --- a/src/NoUnusedDependencies.elm +++ b/src/NoUnusedDependencies.elm @@ -54,7 +54,7 @@ rule = , foldProjectContexts = foldProjectContexts } |> Rule.withElmJsonProjectVisitor elmJsonVisitor - |> Rule.withProjectDependenciesVisitor dependenciesVisitor + |> Rule.withDependenciesProjectVisitor dependenciesVisitor |> Rule.withFinalProjectEvaluation finalEvaluationForProject |> Rule.fromProjectRuleSchema diff --git a/src/Review/Rule.elm b/src/Review/Rule.elm index 975c9481..8e521174 100644 --- a/src/Review/Rule.elm +++ b/src/Review/Rule.elm @@ -5,7 +5,7 @@ module Review.Rule exposing , withSimpleModuleDefinitionVisitor, withSimpleCommentsVisitor, withSimpleImportVisitor, withSimpleDeclarationVisitor, withSimpleExpressionVisitor , withModuleDefinitionVisitor, withCommentsVisitor, withImportVisitor, Direction(..), withDeclarationVisitor, withDeclarationListVisitor, withExpressionVisitor, withFinalModuleEvaluation , withElmJsonModuleVisitor, withDependenciesModuleVisitor - , ProjectRuleSchema, newProjectRuleSchema, fromProjectRuleSchema, withElmJsonProjectVisitor, withProjectDependenciesVisitor, withFinalProjectEvaluation, withContextFromImportedModules + , ProjectRuleSchema, newProjectRuleSchema, fromProjectRuleSchema, withElmJsonProjectVisitor, withDependenciesProjectVisitor, withFinalProjectEvaluation, withContextFromImportedModules , Error, error, errorRuleName, errorMessage, errorDetails, errorRange, errorFixes, errorFilePath, ModuleKey, errorForFile, ElmJsonKey, errorForElmJson , withFixes , ignoreErrorsForDirectories, ignoreErrorsForFiles @@ -189,7 +189,7 @@ Evaluating/visiting a node means two things: ## Creating a project rule -@docs ProjectRuleSchema, newProjectRuleSchema, fromProjectRuleSchema, withElmJsonProjectVisitor, withProjectDependenciesVisitor, withFinalProjectEvaluation, withContextFromImportedModules +@docs ProjectRuleSchema, newProjectRuleSchema, fromProjectRuleSchema, withElmJsonProjectVisitor, withDependenciesProjectVisitor, withFinalProjectEvaluation, withContextFromImportedModules ## Errors @@ -776,7 +776,7 @@ same visitors as for module rules. The exception are the following visitors, whi are replaced by functions that you need to use on the project rule schema. - [`withElmJsonModuleVisitor`](#withElmJsonModuleVisitor), replaced by [`withElmJsonProjectVisitor`](#withElmJsonProjectVisitor) - - [`withDependenciesModuleVisitor`](#withDependenciesModuleVisitor), replaced by [`withProjectDependenciesVisitor`](#withProjectDependenciesVisitor) + - [`withDependenciesModuleVisitor`](#withDependenciesModuleVisitor), replaced by [`withDependenciesProjectVisitor`](#withDependenciesProjectVisitor) - [`withFinalModuleEvaluation`](#withFinalModuleEvaluation), replaced by [`withFinalProjectEvaluation`](#withFinalProjectEvaluation) Let's look at the data that we will be working with. @@ -899,7 +899,7 @@ Before looking at modules...TODO - A final evaluation is made when the module has fully been visited, using [`withFinalModuleEvaluation`](#withFinalModuleEvaluation) You can't use [`withElmJsonModuleVisitor`](#withElmJsonModuleVisitor) or [`withDependenciesModuleVisitor`](#withDependenciesModuleVisitor) -in project rules. Instead, you should use [`withElmJsonProjectVisitor`](#withElmJsonProjectVisitor) or [`withProjectDependenciesVisitor`](#withProjectDependenciesVisitor). +in project rules. Instead, you should use [`withElmJsonProjectVisitor`](#withElmJsonProjectVisitor) or [`withDependenciesProjectVisitor`](#withDependenciesProjectVisitor). -} newProjectRuleSchema : @@ -959,11 +959,11 @@ withElmJsonProjectVisitor visitor (ProjectRuleSchema schema) = {-| TODO documentation -} -withProjectDependenciesVisitor : +withDependenciesProjectVisitor : (Dict String Review.Project.Dependency -> projectContext -> projectContext) -> ProjectRuleSchema projectContext moduleContext -> ProjectRuleSchema projectContext moduleContext -withProjectDependenciesVisitor visitor (ProjectRuleSchema schema) = +withDependenciesProjectVisitor visitor (ProjectRuleSchema schema) = ProjectRuleSchema { schema | dependenciesVisitors = visitor :: schema.dependenciesVisitors } @@ -985,7 +985,7 @@ When you finish analyzing a module, the `moduleContext` is turned into a `projec through [`fromModuleToProject`](#newProjectRuleSchema). Before analyzing a file, the `projectContext`s of its imported modules get folded into a single one starting with the initial context (that may have visited the -[`elm.json` file](#withElmJsonProjectVisitor) and/or the [project's dependencies](#withProjectDependenciesVisitor)) +[`elm.json` file](#withElmJsonProjectVisitor) and/or the [project's dependencies](#withDependenciesProjectVisitor)) using [`foldProjectContexts`](#newProjectRuleSchema). If there is information about another module that you wish to access, you should diff --git a/src/Scope2.elm b/src/Scope2.elm index 06874564..8c6a8eac 100644 --- a/src/Scope2.elm +++ b/src/Scope2.elm @@ -174,7 +174,7 @@ addProjectVisitors : Rule.ProjectRuleSchema { projectContext | scope : ProjectCo addProjectVisitors schema = schema |> Rule.withContextFromImportedModules - |> Rule.withProjectDependenciesVisitor (mapInnerProjectContext dependenciesVisitor) + |> Rule.withDependenciesProjectVisitor (mapInnerProjectContext dependenciesVisitor) addModuleVisitors : Rule.ModuleRuleSchema anything { moduleContext | scope : ModuleContext } -> Rule.ModuleRuleSchema { anything | hasAtLeastOneVisitor : () } { moduleContext | scope : ModuleContext }