SiriusStarr/elm-review-pipeline-styles/1.1.0

NOTE: the latest version is 1.3.9

elm-review-pipeline-styles

Provides elm-review rules to forbid pipelines for code-style reasons.

Provided rules

For example, the usage of <| or the usage of excessively-long |> pipelines.

This rule works with the following pipeline types:

  • |> -- Right "pizza" pipelines, i.e. right function application, so-called because the operator resembles a slice of pizza 🍕.
  • <| -- Left "pizza" pipelines, i.e. left function application, so-called because the operator resembles a slice of pizza 🍕.
  • >> -- Right composition pipelines.
  • << -- Left composition pipelines.
  • foo (bar (baz (i (j k)))) -- Parenthetical application pipelines.

If you don't know where to start, be sure to check out ReviewPipelineStyles.Premade for some ready-made rules, as well as examples of how to construct them.

Configuration

import Review.Rule exposing (Rule)
import ReviewPipelineStyles
import ReviewPipelineStyles.Premade
    exposing
        ( noMultilineLeftPizza
        , noPipelinesWithConfusingNonCommutativeFunctions
        , noPipelinesWithSimpleInputs
        , noRepeatedParentheticalApplication
        , noSemanticallyInfixFunctionsInLeftPipelines
        , noSingleLineRightPizza
        )


config : List Rule
config =
    [ ReviewPipelineStyles.rule <|
        List.concat
            [ noMultilineLeftPizza
            , noSingleLineRightPizza
            , noPipelinesWithSimpleInputs
            , noRepeatedParentheticalApplication
            , noPipelinesWithConfusingNonCommutativeFunctions
            , noSemanticallyInfixFunctionsInLeftPipelines
            ]
    ]

Try it out

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

elm-review --template SiriusStarr/elm-review-pipeline-styles/example

Changlelog

  • 1.1.0
    • Added premade rules for ease of use! Find them in the ReviewPipelineStyles.Premade module. The documentation for these rules includes the source for how to construct them as a sort of tutorial to learn to create your own.
    • Added StepPredicates. Easily inspect individual steps of pipelines!
    • Updated elm-syntax to avoid mangling fixes involving some lambdas.
    • Minor documentation fixes/clarifications.
  • 1.0.0 -- Initial release