diff --git a/src/NoInvalidLicense.elm b/src/NoInvalidLicense.elm index 181a661a..6b1b28a8 100644 --- a/src/NoInvalidLicense.elm +++ b/src/NoInvalidLicense.elm @@ -13,8 +13,6 @@ import Dict exposing (Dict) import Elm.License import Elm.Package import Elm.Project -import Elm.Syntax.ModuleName exposing (ModuleName) -import Elm.Syntax.Node exposing (Node) import Elm.Syntax.Range exposing (Range) import Review.Project.Dependency as Dependency exposing (Dependency) import Review.Rule as Rule exposing (Error, Rule) @@ -34,12 +32,6 @@ import Set exposing (Set) rule : Configuration -> Rule rule configuration = Rule.newProjectRuleSchema "NoInvalidLicense" initialProjectContext - |> Rule.withModuleVisitor moduleVisitor - |> Rule.withModuleContext - { fromProjectToModule = fromProjectToModule - , fromModuleToProject = fromModuleToProject - , foldProjectContexts = foldProjectContexts - } |> Rule.withElmJsonProjectVisitor elmJsonVisitor |> Rule.withDependenciesProjectVisitor dependenciesVisitor |> Rule.withFinalProjectEvaluation (finalEvaluationForProject configuration) @@ -52,12 +44,6 @@ type alias Configuration = } -moduleVisitor : Rule.ModuleRuleSchema {} ModuleContext -> Rule.ModuleRuleSchema { hasAtLeastOneVisitor : () } ModuleContext -moduleVisitor schema = - schema - |> Rule.withModuleDefinitionVisitor (\_ context -> ( [], context )) - - dependenciesVisitor : Dict String Dependency -> ProjectContext -> ( List nothing, ProjectContext ) dependenciesVisitor dependencies projectContext = let @@ -123,10 +109,6 @@ type alias ProjectContext = } -type alias ModuleContext = - ProjectContext - - initialProjectContext : ProjectContext initialProjectContext = { elmJsonKey = Nothing @@ -135,21 +117,6 @@ initialProjectContext = } -fromProjectToModule : Rule.ModuleKey -> Node ModuleName -> ProjectContext -> ModuleContext -fromProjectToModule _ _ projectContext = - projectContext - - -fromModuleToProject : Rule.ModuleKey -> Node ModuleName -> ModuleContext -> ProjectContext -fromModuleToProject _ _ moduleContext = - moduleContext - - -foldProjectContexts : ProjectContext -> ProjectContext -> ProjectContext -foldProjectContexts _ previousContext = - previousContext - - -- FINAL EVALUATION diff --git a/src/ReadmeStartsWithProjectTitle.elm b/src/ReadmeStartsWithProjectTitle.elm index 878a67bc..bf86f9ab 100644 --- a/src/ReadmeStartsWithProjectTitle.elm +++ b/src/ReadmeStartsWithProjectTitle.elm @@ -9,23 +9,11 @@ import Review.Rule as Rule exposing (Error, Rule) rule : Rule rule = Rule.newProjectRuleSchema "ReadmeStartsWithProjectTitle" initialProjectContext - |> Rule.withModuleVisitor moduleVisitor - |> Rule.withModuleContext - { fromProjectToModule = fromProjectToModule - , fromModuleToProject = fromModuleToProject - , foldProjectContexts = foldProjectContexts - } |> Rule.withElmJsonProjectVisitor elmJsonVisitor |> Rule.withReadmeProjectVisitor readmeVisitor |> Rule.fromProjectRuleSchema -moduleVisitor : Rule.ModuleRuleSchema {} ModuleContext -> Rule.ModuleRuleSchema { hasAtLeastOneVisitor : () } ModuleContext -moduleVisitor schema = - schema - |> Rule.withModuleDefinitionVisitor (\_ context -> ( [], context )) - - type alias ProjectContext = { projectTitle : Maybe String } @@ -37,25 +25,6 @@ initialProjectContext = } -type alias ModuleContext = - ProjectContext - - -fromProjectToModule : Rule.ModuleKey -> a -> ProjectContext -> ModuleContext -fromProjectToModule _ _ projectContext = - projectContext - - -fromModuleToProject : Rule.ModuleKey -> a -> ModuleContext -> ProjectContext -fromModuleToProject _ _ moduleContext = - moduleContext - - -foldProjectContexts : ProjectContext -> ProjectContext -> ProjectContext -foldProjectContexts _ previousContext = - previousContext - - -- elm.json VISITOR diff --git a/tests/Review/RuleElmJsonErrorsTest.elm b/tests/Review/RuleElmJsonErrorsTest.elm index 5d2368a4..f719cdfd 100644 --- a/tests/Review/RuleElmJsonErrorsTest.elm +++ b/tests/Review/RuleElmJsonErrorsTest.elm @@ -16,43 +16,16 @@ type alias Context = rule : Rule rule = Rule.newProjectRuleSchema "TestRule" initialProjectContext - |> Rule.withModuleVisitor moduleVisitor - |> Rule.withModuleContext - { fromProjectToModule = fromProjectToModule - , fromModuleToProject = fromModuleToProject - , foldProjectContexts = foldProjectContexts - } |> Rule.withElmJsonProjectVisitor (\elmJson _ -> ( [], elmJson |> Maybe.map .elmJsonKey )) |> Rule.withFinalProjectEvaluation finalEvaluationForProject |> Rule.fromProjectRuleSchema -moduleVisitor : Rule.ModuleRuleSchema {} Context -> Rule.ModuleRuleSchema { hasAtLeastOneVisitor : () } Context -moduleVisitor schema = - schema - |> Rule.withModuleDefinitionVisitor (\moduleNode context -> ( [], context )) - - initialProjectContext : Context initialProjectContext = Nothing -fromProjectToModule : a -> b -> Context -> Context -fromProjectToModule _ _ projectContext = - projectContext - - -fromModuleToProject : a -> b -> Context -> Context -fromModuleToProject _ _ moduleContext = - moduleContext - - -foldProjectContexts : Context -> Context -> Context -foldProjectContexts newContext previousContext = - previousContext - - finalEvaluationForProject : Context -> List Rule.Error finalEvaluationForProject maybeElmJsonKey = case maybeElmJsonKey of