Update the demo to work with recent API changes

This commit is contained in:
Jeroen Engels 2020-01-15 10:16:28 +01:00
parent b654daa301
commit 4b2ce76584
2 changed files with 16 additions and 4 deletions

View File

@ -10,7 +10,7 @@ import NoUnused.Variables
import Reporter
import Review
import Review.File exposing (RawFile)
import Review.Project as Project
import Review.Project as Project exposing (Project)
import Review.Rule as Rule exposing (Rule)
@ -33,6 +33,7 @@ main =
type alias Model =
{ sourceCode : String
, project : Project
, reviewErrors : List Rule.Error
, noDebugEnabled : Bool
, noUnusedVariablesEnabled : Bool
@ -66,6 +67,7 @@ g n = n + 1
"""
in
{ sourceCode = sourceCode
, project = Project.withModule (file sourceCode) Project.new
, reviewErrors = []
, noDebugEnabled = True
, noUnusedVariablesEnabled = True
@ -105,7 +107,10 @@ update : Msg -> Model -> Model
update action model =
case action of
UserEditedSourceCode sourceCode ->
{ model | sourceCode = sourceCode }
{ model
| sourceCode = sourceCode
, project = Project.withModule (file sourceCode) model.project
}
|> runReview
UserToggledNoDebugRule ->
@ -126,7 +131,11 @@ update action model =
runReview : Model -> Model
runReview model =
{ model | reviewErrors = Review.reviewRawFiles (config model) Project.new [ file model.sourceCode ] }
{ model
| reviewErrors =
Review.review (config model) model.project
|> Tuple.first
}

View File

@ -14,10 +14,13 @@
"elm/core": "1.0.2",
"elm/html": "1.0.0",
"elm/project-metadata-utils": "1.0.0",
"elm-community/graph": "6.0.0",
"elm-community/intdict": "3.0.0",
"jinjor/elm-diff": "1.0.6",
"stil4m/elm-syntax": "7.1.0"
},
"indirect": {
"avh4/elm-fifo": "1.0.4",
"elm/json": "1.1.3",
"elm/parser": "1.1.0",
"elm/time": "1.0.0",