Remove unused code

This commit is contained in:
Jeroen Engels 2020-06-26 19:39:07 +02:00
parent 34810b1e64
commit 0688386fb8
4 changed files with 3 additions and 31 deletions

View File

@ -589,7 +589,7 @@ newModuleRuleSchema name_ moduleContext =
{-| Create a [`Rule`](#Rule) from a configured [`ModuleRuleSchema`](#ModuleRuleSchema).
-}
fromModuleRuleSchema : ModuleRuleSchema { schemaState | hasAtLeastOneVisitor : () } moduleContext -> Rule
fromModuleRuleSchema ((ModuleRuleSchema { name }) as schema) =
fromModuleRuleSchema schema =
Rule
{ exceptions = Exceptions.init
, ruleImplementation = runModuleRule (reverseVisitors schema) Nothing

View File

@ -6,12 +6,10 @@ module Review.Rule3 exposing
, newModuleRuleSchema
, newProjectRuleSchema
, review
, withCommentsVisitor
, withContextFromImportedModules
, withDeclarationEnterVisitor
, withDeclarationExitVisitor
, withDeclarationListVisitor
, withDeclarationVisitor
, withDependenciesModuleVisitor
, withDependenciesProjectVisitor
, withElmJsonModuleVisitor
@ -45,7 +43,7 @@ import Elm.Syntax.Node as Node exposing (Node)
import Elm.Syntax.Range as Range
import Review.Context as Context exposing (Context)
import Review.Error exposing (ReviewError)
import Review.Exceptions as Exceptions exposing (Exceptions)
import Review.Exceptions as Exceptions
import Review.Metadata as Metadata
import Review.Project exposing (Project)
import Review.Project.Dependency
@ -105,13 +103,6 @@ newProjectRuleSchema name initialProjectContext =
}
type alias ModuleContextFunctions projectContext moduleContext =
{ fromProjectToModule : ModuleKey -> Node ModuleName -> projectContext -> moduleContext
, fromModuleToProject : ModuleKey -> Node ModuleName -> moduleContext -> projectContext
, foldProjectContexts : projectContext -> projectContext -> projectContext
}
type ModuleRuleSchema schemaState moduleContext
= ModuleRuleSchema
{ name : String
@ -548,15 +539,6 @@ withSimpleDeclarationVisitor visitor schema =
schema
withDeclarationVisitor : (Node Declaration -> Direction -> moduleContext -> ( List (Error {}), moduleContext )) -> ModuleRuleSchema schemaState moduleContext -> ModuleRuleSchema { schemaState | hasAtLeastOneVisitor : () } moduleContext
withDeclarationVisitor visitor (ModuleRuleSchema schema) =
ModuleRuleSchema
{ schema
| declarationVisitorsOnEnter = (\node ctx -> visitor node OnEnter ctx) :: schema.declarationVisitorsOnEnter
, declarationVisitorsOnExit = (\node ctx -> visitor node OnExit ctx) :: schema.declarationVisitorsOnExit
}
withDeclarationEnterVisitor : (Node Declaration -> moduleContext -> ( List (Error {}), moduleContext )) -> ModuleRuleSchema schemaState moduleContext -> ModuleRuleSchema { schemaState | hasAtLeastOneVisitor : () } moduleContext
withDeclarationEnterVisitor visitor (ModuleRuleSchema schema) =
ModuleRuleSchema { schema | declarationVisitorsOnEnter = visitor :: schema.declarationVisitorsOnEnter }

View File

@ -1,6 +1,5 @@
module Review.Visitor exposing
( Folder
, RuleInternals
, RunnableModuleVisitor
, RunnableProjectVisitor
, TraversalAndFolder(..)
@ -39,15 +38,6 @@ import Vendor.Graph as Graph exposing (Graph)
import Vendor.IntDict as IntDict
type alias RuleInternals =
-- TODO Import this in Review.Rule
{ exceptions : Exceptions
-- TODO Can we get rid of exceptions either above or in the ruleImplementation?
, ruleImplementation : Exceptions -> Project -> List (Graph.NodeContext ModuleName ()) -> ( List (Error {}), Rule )
}
type alias RunnableProjectVisitor projectContext moduleContext =
{ initialProjectContext : projectContext
, elmJsonVisitors : List (Maybe { elmJsonKey : ElmJsonKey, project : Elm.Project.Project } -> projectContext -> ( List (Error {}), projectContext ))

View File

@ -75,7 +75,7 @@ import Elm.Syntax.Type
import Elm.Syntax.TypeAnnotation as TypeAnnotation exposing (TypeAnnotation)
import Elm.Type
import Review.Project.Dependency as Dependency exposing (Dependency)
import Review.Rule as Rule exposing (Direction)
import Review.Rule as Rule
import Review.Rule3 as Rule3
import Set exposing (Set)