Skip to content

Commit

Permalink
extend elm-review rules
Browse files Browse the repository at this point in the history
  • Loading branch information
decioferreira committed Dec 11, 2024
1 parent a163886 commit bc969bc
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 9 deletions.
12 changes: 6 additions & 6 deletions review/src/ReviewConfig.elm
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ config =
[ Docs.ReviewAtDocs.rule
, NoConfusingPrefixOperator.rule
, NoDebug.Log.rule

-- , NoDebug.TodoOrToString.rule
-- |> Rule.ignoreErrorsForDirectories [ "tests/" ]
, NoDebug.TodoOrToString.rule
|> Rule.ignoreErrorsForDirectories [ "tests/" ]
, NoExposingEverything.rule
, NoImportingEverything.rule []
, NoMissingTypeAnnotation.rule
Expand All @@ -54,8 +53,9 @@ config =
, NoUnused.Dependencies.rule

-- , NoUnused.Exports.rule
-- , NoUnused.Parameters.rule
-- , NoUnused.Patterns.rule
-- , NoUnused.Variables.rule
, NoUnused.Parameters.rule
|> Rule.ignoreErrorsForFiles [ "src/Utils/Crash.elm" ]
, NoUnused.Patterns.rule
, NoUnused.Variables.rule
, Simplify.rule Simplify.defaults
]
2 changes: 1 addition & 1 deletion src/Data/Map.elm
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ merge :
-> Dict comparable k b
-> result
-> result
merge keyComparison leftStep bothStep rightStep (D leftDict) (D rightDict) initialResult =
merge _ leftStep bothStep rightStep (D leftDict) (D rightDict) initialResult =
Dict.merge
(\_ ( k, a ) -> leftStep k a)
(\_ ( k, a ) ( _, b ) -> bothStep k a b)
Expand Down
42 changes: 41 additions & 1 deletion src/System/IO.elm
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ run app =
, recvDirCanonicalizePath (\{ index, value } -> DirCanonicalizePathMsg index value)
, recvBinaryDecodeFileOrFail (\{ index, value } -> BinaryDecodeFileOrFailMsg index value)
, recvWrite WriteMsg
, recvDirRemoveFile DirRemoveFileMsg
, recvDirRemoveDirectoryRecursive DirRemoveDirectoryRecursiveMsg
, recvDirWithCurrentDirectory DirWithCurrentDirectoryMsg
, recvReplGetInputLineWithInitial (\{ index, value } -> ReplGetInputLineWithInitialMsg index value)
, recvNewEmptyMVar (\{ index, value } -> NewEmptyMVarMsg index value)
, recvReadMVar (\{ index, value } -> ReadMVarMsg index value)
, recvPutMVar PutMVarMsg
Expand Down Expand Up @@ -212,6 +216,10 @@ type Msg
| DirCanonicalizePathMsg Int FilePath
| BinaryDecodeFileOrFailMsg Int Encode.Value
| WriteMsg Int
| DirRemoveFileMsg Int
| DirRemoveDirectoryRecursiveMsg Int
| DirWithCurrentDirectoryMsg Int
| ReplGetInputLineWithInitialMsg Int (Maybe String)
| NewEmptyMVarMsg Int Int
| ReadMVarMsg Int Encode.Value
| PutMVarMsg Int
Expand Down Expand Up @@ -575,6 +583,38 @@ update msg model =
_ ->
crash "WriteMsg"

DirRemoveFileMsg index ->
case Dict.get index model.next of
Just (DirRemoveFileNext fn) ->
update (PureMsg index (fn ())) model

_ ->
crash "DirRemoveFileMsg"

DirRemoveDirectoryRecursiveMsg index ->
case Dict.get index model.next of
Just (DirRemoveDirectoryRecursiveNext fn) ->
update (PureMsg index (fn ())) model

_ ->
crash "DirRemoveDirectoryRecursiveMsg"

DirWithCurrentDirectoryMsg index ->
case Dict.get index model.next of
Just (DirWithCurrentDirectoryNext fn) ->
update (PureMsg index (fn ())) model

_ ->
crash "DirWithCurrentDirectoryMsg"

ReplGetInputLineWithInitialMsg index value ->
case Dict.get index model.next of
Just (ReplGetInputLineWithInitialNext fn) ->
update (PureMsg index (fn value)) model

_ ->
crash "ReplGetInputLineWithInitialMsg"


port sendGetLine : Int -> Cmd msg

Expand Down Expand Up @@ -744,7 +784,7 @@ port recvDirWithCurrentDirectory : (Int -> msg) -> Sub msg
port sendReplGetInputLineWithInitial : { index : Int, prompt : String, left : String, right : String } -> Cmd msg


port recvReplGetInputLineWithInitial : (Maybe String -> msg) -> Sub msg
port recvReplGetInputLineWithInitial : ({ index : Int, value : Maybe String } -> msg) -> Sub msg



Expand Down
1 change: 0 additions & 1 deletion src/Utils/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ import Basics.Extra exposing (flip)
import Builder.Reporting.Task as Task exposing (Task)
import Compiler.Data.Index as Index
import Compiler.Data.NonEmptyList as NE
import Compiler.Elm.Version exposing (toComparable)
import Compiler.Json.Decode as D
import Compiler.Json.Encode as E
import Compiler.Reporting.Result as R
Expand Down

0 comments on commit bc969bc

Please sign in to comment.