Move again

This commit is contained in:
Jeroen Engels 2020-08-19 23:26:48 +02:00
parent 494d376ba6
commit 556a4b24bc
6 changed files with 28 additions and 14 deletions

View File

@ -0,0 +1,7 @@
module Review.ModuleNameLookupTable exposing (..)
import Review.ModuleNameLookupTable.Internal as Internal
type alias ModuleNameLookupTable =
Internal.ModuleNameLookupTable

View File

@ -0,0 +1,10 @@
module Review.ModuleNameLookupTable.Internal exposing (ModuleNameLookupTable(..), empty)
type ModuleNameLookupTable
= ModuleNameLookupTable
empty : ModuleNameLookupTable
empty =
ModuleNameLookupTable

View File

@ -4,7 +4,6 @@ module Review.Project exposing
, addElmJson, elmJson , addElmJson, elmJson
, addReadme, readme , addReadme, readme
, addDependency, removeDependencies, dependencies , addDependency, removeDependencies, dependencies
, ModuleNameLookupTable
) )
{-| Represents the contents of the project to be analyzed. This information will {-| Represents the contents of the project to be analyzed. This information will
@ -80,10 +79,6 @@ new =
} }
type alias ModuleNameLookupTable =
Internal.ModuleNameLookupTable
-- PROJECT FILES -- PROJECT FILES
@ -245,6 +240,7 @@ precomputeModuleGraph ((Internal.Project p) as project) =
project project
Nothing -> Nothing ->
--|> Internal.Project.compute
Internal.Project { p | moduleGraph = Just <| Internal.buildModuleGraph <| Dict.values p.modules } Internal.Project { p | moduleGraph = Just <| Internal.buildModuleGraph <| Dict.values p.modules }

View File

@ -1,6 +1,5 @@
module Review.Project.Internal exposing module Review.Project.Internal exposing
( ModuleNameLookupTable ( Project(..)
, Project(..)
, ProjectModule , ProjectModule
, buildModuleGraph , buildModuleGraph
, moduleGraph , moduleGraph
@ -17,6 +16,7 @@ import Elm.Syntax.File
import Elm.Syntax.Module import Elm.Syntax.Module
import Elm.Syntax.ModuleName exposing (ModuleName) import Elm.Syntax.ModuleName exposing (ModuleName)
import Elm.Syntax.Node as Node import Elm.Syntax.Node as Node
import Review.ModuleNameLookupTable exposing (ModuleNameLookupTable)
import Review.Project.Dependency exposing (Dependency) import Review.Project.Dependency exposing (Dependency)
import Vendor.Graph as Graph exposing (Graph) import Vendor.Graph as Graph exposing (Graph)
@ -44,10 +44,6 @@ type alias ProjectModule =
} }
type alias ModuleNameLookupTable =
()
{-| Get the module graph for the project in the form of a {-| Get the module graph for the project in the form of a
[`elm-community/graph` Graph]. This is used by `Review.Rule` internally. [`elm-community/graph` Graph]. This is used by `Review.Rule` internally.

View File

@ -266,7 +266,9 @@ import Elm.Syntax.Range as Range exposing (Range)
import Review.Error exposing (InternalError) import Review.Error exposing (InternalError)
import Review.Exceptions as Exceptions exposing (Exceptions) import Review.Exceptions as Exceptions exposing (Exceptions)
import Review.Fix exposing (Fix) import Review.Fix exposing (Fix)
import Review.Project exposing (ModuleNameLookupTable, Project, ProjectModule) import Review.ModuleNameLookupTable exposing (ModuleNameLookupTable)
import Review.ModuleNameLookupTable.Internal as ModuleNameLookupTableInternal
import Review.Project exposing (Project, ProjectModule)
import Review.Project.Dependency import Review.Project.Dependency
import Review.Project.Internal import Review.Project.Internal
import Set exposing (Set) import Set exposing (Set)
@ -866,6 +868,7 @@ mergeModuleVisitors initialProjectContext maybeModuleContextCreator visitors =
, isInSourceDirectories = True , isInSourceDirectories = True
} }
, moduleKey = ModuleKey "dummy" , moduleKey = ModuleKey "dummy"
, moduleNameLookupTable = ModuleNameLookupTableInternal.empty
} }
initialModuleContext : moduleContext initialModuleContext : moduleContext
@ -3342,6 +3345,7 @@ computeModules projectVisitor ( moduleVisitor, moduleContextCreator ) project ex
availableData = availableData =
{ metadata = metadata { metadata = metadata
, moduleKey = moduleKey , moduleKey = moduleKey
, moduleNameLookupTable = ModuleNameLookupTableInternal.empty
} }
initialModuleContext : moduleContext initialModuleContext : moduleContext
@ -3833,7 +3837,7 @@ withMetadata (ContextCreator fn (RequestedData requested)) =
withModuleNameLookupTable : ContextCreator ModuleNameLookupTable (from -> to) -> ContextCreator from to withModuleNameLookupTable : ContextCreator ModuleNameLookupTable (from -> to) -> ContextCreator from to
withModuleNameLookupTable (ContextCreator fn (RequestedData requested)) = withModuleNameLookupTable (ContextCreator fn (RequestedData requested)) =
ContextCreator ContextCreator
(\data -> fn data ()) (\data -> fn data data.moduleNameLookupTable)
(RequestedData { requested | moduleNameLookupTable = True }) (RequestedData { requested | moduleNameLookupTable = True })
@ -3862,6 +3866,7 @@ withModuleKey (ContextCreator fn (RequestedData requested)) =
type alias AvailableData = type alias AvailableData =
{ metadata : Metadata { metadata : Metadata
, moduleKey : ModuleKey , moduleKey : ModuleKey
, moduleNameLookupTable : ModuleNameLookupTable
} }

View File

@ -2,7 +2,7 @@ module MiscRules.NoHtmlButton exposing (rule)
import Elm.Syntax.Expression exposing (Expression(..)) import Elm.Syntax.Expression exposing (Expression(..))
import Elm.Syntax.Node as Node exposing (Node) import Elm.Syntax.Node as Node exposing (Node)
import Review.Project exposing (ModuleNameLookupTable) import Review.ModuleNameLookupTable exposing (ModuleNameLookupTable)
import Review.Rule as Rule exposing (Error, Rule) import Review.Rule as Rule exposing (Error, Rule)
import Scope import Scope