From b654daa30120648e5a73035205a9fd14146771ef Mon Sep 17 00:00:00 2001 From: Jeroen Engels Date: Wed, 15 Jan 2020 09:54:26 +0100 Subject: [PATCH] Remove unused code and dependencies --- demo/Main.elm | 2 +- src/NoUnusedExports.elm | 1 - src/NoUnusedModules.elm | 1 - src/NonemptyList.elm | 7 ------- src/Review.elm | 4 ---- src/Review/Project.elm | 2 -- src/Review/Rule.elm | 2 +- tests/NoHtmlButtonTest.elm | 1 - tests/NoUnusedExportsTest.elm | 5 +---- tests/NoUnusedModulesTest.elm | 5 +---- tests/Review/RuleVisitorsOrderTest.elm | 9 --------- tests/Scope2Test.elm | 8 +------- tests/ScopeTest.elm | 1 - 13 files changed, 5 insertions(+), 43 deletions(-) diff --git a/demo/Main.elm b/demo/Main.elm index 8768da84..ab5f589f 100644 --- a/demo/Main.elm +++ b/demo/Main.elm @@ -9,7 +9,7 @@ import NoUnused.CustomTypeConstructors import NoUnused.Variables import Reporter import Review -import Review.File exposing (ParsedFile, RawFile) +import Review.File exposing (RawFile) import Review.Project as Project import Review.Rule as Rule exposing (Rule) diff --git a/src/NoUnusedExports.elm b/src/NoUnusedExports.elm index 17ae1005..c01b4735 100644 --- a/src/NoUnusedExports.elm +++ b/src/NoUnusedExports.elm @@ -18,7 +18,6 @@ import Elm.Project exposing (Project) import Elm.Syntax.Declaration as Declaration exposing (Declaration) import Elm.Syntax.Exposing as Exposing import Elm.Syntax.Expression as Expression exposing (Expression) -import Elm.Syntax.Import exposing (Import) import Elm.Syntax.Module as Module exposing (Module) import Elm.Syntax.ModuleName exposing (ModuleName) import Elm.Syntax.Node as Node exposing (Node) diff --git a/src/NoUnusedModules.elm b/src/NoUnusedModules.elm index 29ed4320..1bcaf47b 100644 --- a/src/NoUnusedModules.elm +++ b/src/NoUnusedModules.elm @@ -14,7 +14,6 @@ import Elm.Module import Elm.Project exposing (Project) import Elm.Syntax.Declaration as Declaration exposing (Declaration) import Elm.Syntax.Import exposing (Import) -import Elm.Syntax.Module as Module exposing (Module) import Elm.Syntax.ModuleName exposing (ModuleName) import Elm.Syntax.Node as Node exposing (Node) import Elm.Syntax.Range exposing (Range) diff --git a/src/NonemptyList.elm b/src/NonemptyList.elm index 6f2eaee2..56bf1186 100644 --- a/src/NonemptyList.elm +++ b/src/NonemptyList.elm @@ -136,10 +136,3 @@ pop (Nonempty x xs) = mapHead : (a -> a) -> Nonempty a -> Nonempty a mapHead fn (Nonempty x xs) = Nonempty (fn x) xs - - -{-| Exchange the head element while leaving the tail alone. --} -replaceHead : a -> Nonempty a -> Nonempty a -replaceHead y (Nonempty x xs) = - Nonempty y xs diff --git a/src/Review.elm b/src/Review.elm index 48e945b4..9ffa4843 100644 --- a/src/Review.elm +++ b/src/Review.elm @@ -9,10 +9,6 @@ module Review exposing (review) -} -import Elm.Parser as Parser -import Elm.Processing exposing (init, process) -import Elm.Syntax.File exposing (File) -import Review.File exposing (ParsedFile, RawFile) import Review.Project exposing (Project) import Review.Rule as Rule exposing (Error, Rule) diff --git a/src/Review/Project.elm b/src/Review/Project.elm index 993aaa3b..a550cf0e 100644 --- a/src/Review/Project.elm +++ b/src/Review/Project.elm @@ -40,9 +40,7 @@ import Elm.Syntax.Module import Elm.Syntax.ModuleName exposing (ModuleName) import Elm.Syntax.Node as Node import Graph exposing (Graph) -import IntDict exposing (IntDict) import Review.File exposing (ParsedFile) -import Set exposing (Set) diff --git a/src/Review/Rule.elm b/src/Review/Rule.elm index 8e98608a..0e1106e0 100644 --- a/src/Review/Rule.elm +++ b/src/Review/Rule.elm @@ -210,7 +210,7 @@ import Elm.Syntax.ModuleName exposing (ModuleName) import Elm.Syntax.Node as Node exposing (Node) import Elm.Syntax.Range exposing (Range) import Graph exposing (Graph) -import IntDict exposing (IntDict) +import IntDict import Review.File exposing (ParsedFile, RawFile) import Review.Fix exposing (Fix) import Review.Project exposing (Project) diff --git a/tests/NoHtmlButtonTest.elm b/tests/NoHtmlButtonTest.elm index 9f3be40c..ac8cbf0b 100644 --- a/tests/NoHtmlButtonTest.elm +++ b/tests/NoHtmlButtonTest.elm @@ -1,7 +1,6 @@ module NoHtmlButtonTest exposing (all) import Dependencies -import Elm.Type as Type import NoHtmlButton exposing (rule) import Review.Project as Project exposing (Project) import Review.Test exposing (ReviewResult) diff --git a/tests/NoUnusedExportsTest.elm b/tests/NoUnusedExportsTest.elm index 8c76ab47..b09868f2 100644 --- a/tests/NoUnusedExportsTest.elm +++ b/tests/NoUnusedExportsTest.elm @@ -1,17 +1,14 @@ module NoUnusedExportsTest exposing (all) -import Dependencies import Elm.Constraint import Elm.License import Elm.Module import Elm.Package import Elm.Project -import Elm.Type as Type import Elm.Version -import Expect import NoUnusedExports exposing (rule) import Review.Project as Project exposing (Project) -import Review.Test exposing (ReviewResult) +import Review.Test import Test exposing (Test, describe, test) diff --git a/tests/NoUnusedModulesTest.elm b/tests/NoUnusedModulesTest.elm index 9ea3d933..826cc539 100644 --- a/tests/NoUnusedModulesTest.elm +++ b/tests/NoUnusedModulesTest.elm @@ -1,17 +1,14 @@ module NoUnusedModulesTest exposing (all) -import Dependencies import Elm.Constraint import Elm.License import Elm.Module import Elm.Package import Elm.Project -import Elm.Type as Type import Elm.Version -import Expect import NoUnusedModules exposing (rule) import Review.Project as Project exposing (Project) -import Review.Test exposing (ReviewResult) +import Review.Test import Test exposing (Test, describe, test) diff --git a/tests/Review/RuleVisitorsOrderTest.elm b/tests/Review/RuleVisitorsOrderTest.elm index 3cd9119e..5cc929d1 100644 --- a/tests/Review/RuleVisitorsOrderTest.elm +++ b/tests/Review/RuleVisitorsOrderTest.elm @@ -55,15 +55,6 @@ all = |> Rule.withFinalEvaluation finalEvaluation |> Rule.fromSchema - declarationVisitor : String -> Node Expression -> Rule.Direction -> Context -> ( List Rule.Error, Context ) - declarationVisitor text node direction context = - case direction of - Rule.OnEnter -> - ( [], context ++ "\nEnter " ++ text ) - - Rule.OnExit -> - ( [], context ++ "\nExit " ++ text ) - finalEvaluation : Context -> List Rule.Error finalEvaluation context = [ Rule.error { message = context, details = [ "details" ] } diff --git a/tests/Scope2Test.elm b/tests/Scope2Test.elm index d506eced..0c3a336d 100644 --- a/tests/Scope2Test.elm +++ b/tests/Scope2Test.elm @@ -5,10 +5,9 @@ import Elm.Syntax.Declaration as Declaration exposing (Declaration) import Elm.Syntax.Expression as Expression exposing (Expression) import Elm.Syntax.Node as Node exposing (Node(..)) import Elm.Syntax.TypeAnnotation as TypeAnnotation exposing (TypeAnnotation) -import Elm.Type import Review.Project as Project exposing (Project) import Review.Rule as Rule exposing (Rule) -import Review.Test exposing (ReviewResult) +import Review.Test import Scope2 as Scope import Test exposing (Test, test) @@ -112,11 +111,6 @@ Http.get -> Http.get ] -type alias GlobalContext = - { scope : Scope.GlobalContext - } - - type alias ModuleContext = { scope : Scope.ModuleContext , text : String diff --git a/tests/ScopeTest.elm b/tests/ScopeTest.elm index 660736f0..df94ef92 100644 --- a/tests/ScopeTest.elm +++ b/tests/ScopeTest.elm @@ -1,7 +1,6 @@ module ScopeTest exposing (all) import Dependencies -import Elm.Syntax.Declaration exposing (Declaration) import Elm.Syntax.Expression as Expression exposing (Expression) import Elm.Syntax.Node as Node exposing (Node) import Review.Project as Project exposing (Project)