module Hadolint.Rule.DL3012 (rule) where import Hadolint.Rule import Language.Docker.Syntax rule :: Rule args rule :: forall args. Rule args rule = forall a args. (Linenumber -> State a -> Instruction args -> State a) -> State a -> Rule args customRule forall {args}. Linenumber -> State Bool -> Instruction args -> State Bool check (forall a. a -> State a emptyState Bool False) where code :: RuleCode code = RuleCode "DL3012" severity :: DLSeverity severity = DLSeverity DLErrorC message :: Text message = Text "Multiple `HEALTHCHECK` instructions" check :: Linenumber -> State Bool -> Instruction args -> State Bool check Linenumber _ State Bool st From {} = State Bool st forall a b. a -> (a -> b) -> b |> forall a. a -> State a -> State a replaceWith Bool False check Linenumber line State Bool st Healthcheck {} | Bool -> Bool not (forall a. State a -> a state State Bool st) = State Bool st forall a b. a -> (a -> b) -> b |> forall a. a -> State a -> State a replaceWith Bool True | Bool otherwise = State Bool st forall a b. a -> (a -> b) -> b |> forall a. CheckFailure -> State a -> State a addFail CheckFailure {Linenumber Text RuleCode DLSeverity line :: Linenumber message :: Text severity :: DLSeverity code :: RuleCode line :: Linenumber message :: Text severity :: DLSeverity code :: RuleCode ..} check Linenumber _ State Bool st Instruction args _ = State Bool st {-# INLINEABLE rule #-}