Skip to content

sparksp/elm-review-forbidden-words

Repository files navigation

elm-review-forbidden-words

elm package elm-review 2.3 elm 0.19 Tests

Provides an elm-review rule to forbid certain words in Elm comments, README and elm.json.

Example configuration

module ReviewConfig exposing (config)

import NoForbiddenWords
import Review.Rule exposing (Rule)

config : List Rule
config =
    [ NoForbiddenWords.rule [ "TODO", "- [ ]" ]
    ]

Note: We search for the exact string that you enter, so if you're looking for "TODO" we won't report "todo".

Failure Examples

Based on the configured words "TODO" and "- [ ]" the following examples would fail:

-- TODO: Finish writing this function
   ^^^^
-- [ ] Documentation
 ^^^^^
{- Actions
    - [ ] Documentation
    ^^^^^
    - [ ] Tests
    ^^^^^
-}
{
    "summary": "TODO write a summary",
                ^^^^
}

Ignore README.md

You can easily ignore forbidden words in the README file like this:

import NoForbiddenWords
import Review.Rule exposing (Rule)

config : List Rule
config =
    [ NoForbiddenWords.rule [ "TODO", "- [ ]" ]
        |> Rule.ignoreErrorsForFiles [ "README.md" ]
    ]

Try it out

You can try the example configuration above out by running the following command:

elm-review --template sparksp/elm-review-forbidden-words/example