Helps with preventing redundant usage of concatenation. Expressions like [ a ] ++ b
can be rewritten as a :: b
, and expressions like [ a ] ++ [ b ]
could
be simply [ a, b ]
.
module ReviewConfig exposing (config)
import NoRedundantConcat
import Review.Rule exposing (Rule)
config : List Rule
config =
[ NoRedundantConcat.rule
]
- Concatenating list literals with
++
([ foo ] ++ [ bar ] -> [ foo, bar ]
) - Concatenating a list literal with some other value (
[ foo ] ++ bar -> foo :: bar
) - Using
List.concat
with list literals (List.concat [ [ foo ], [ bar ] ] -> [ foo, bar ]
) - Using
++
withString
literals ("foo" ++ "bar" -> "foobar"
)
- Using
List.append
with list literals - Using
String.append
with string literals - Using
String.concat
with string literals - Using
String.join ""
overString.concat
These all follow a common pattern of making the concatenation of literals more complex than it has to be.