Checks your small code examples in the readme, module headers and declaration comments for valid syntax, matching types and correctness by generating tests from these code snippets.
import Review.Documentation.CodeSnippet
config =
[ Review.Documentation.CodeSnippet.check
]A version of check
primarily intended to offer compatibility with elm-verify-examples
for legacy codebases.
It will implicitly interpret
module CurrentModule exposing (doSomething)
{-| Does something
doSomething --> "something was done"
-}
doSomethingas
module CurrentModule exposing (doSomething)
{-| Does something
import CurrentModule exposing (..)
doSomething --> "something was done"
-}
doSomethingHistory: This was the previous behaviour of the rule in version 1. Shadowing issues initiated the search for better alternatives. Requiring explicit imports for exposing members of the current module turned out to make the snippets easier to understand, easier to copy into your code and less error prone. See above linked issue to see considered alternatives or suggest one yourself.
Ruleto generate tests from your documentation examples (readme, module header, declaration comment) and also to report syntax errors for these code snippets. There are two kinds of checks:value checks
This verifies that the actual value of the expression before
-->is the same as the expected value after-->.type checks
Note that because you use the type
Codecunqualified in your check, you have to explicitly import it. (This is different fromelm-verify-exampleswhich implicitly exposes all local module members. In case you want to simulate that behaviour for legacy reasons, usecheckImplicitlyImportingEverythingFromCurrentModule)important The rule will only report syntax and type errors if your code snippet contains at least one of these two checks, so replace
with
Both checks will be run on all modules and the readme. If you want to disable this for e.g. generated or vendored code, use
Review.Rule.ignoreErrorsForDirectories