module Hadolint.Rule.DL3061 (rule) where import Hadolint.Rule import Language.Docker.Syntax rule :: Rule args rule :: Rule args rule = (Linenumber -> State Bool -> Instruction args -> State Bool) -> State Bool -> Rule args forall a args. (Linenumber -> State a -> Instruction args -> State a) -> State a -> Rule args customRule Linenumber -> State Bool -> Instruction args -> State Bool forall args. Linenumber -> State Bool -> Instruction args -> State Bool check (Bool -> State Bool forall a. a -> State a emptyState Bool False) where code :: RuleCode code = RuleCode "DL3061" severity :: DLSeverity severity = DLSeverity DLErrorC message :: Text message = Text "Invalid instruction order. Dockerfile must begin with `FROM`,\ \ `ARG` or comment." check :: Linenumber -> State Bool -> Instruction args -> State Bool check Linenumber _ State Bool st (From BaseImage _) = State Bool st State Bool -> (State Bool -> State Bool) -> State Bool forall a b. a -> (a -> b) -> b |> Bool -> State Bool -> State Bool forall a. a -> State a -> State a replaceWith Bool True check Linenumber _ State Bool st (Comment Text _) = State Bool st check Linenumber _ State Bool st (Pragma PragmaDirective _) = State Bool st check Linenumber _ State Bool st (Arg Text _ Maybe Text _) = State Bool st check Linenumber line State Bool st Instruction args _ | State Bool -> Bool forall a. State a -> a state State Bool st = State Bool st | Bool otherwise = State Bool st State Bool -> (State Bool -> State Bool) -> State Bool forall a b. a -> (a -> b) -> b |> CheckFailure -> State Bool -> State Bool forall a. CheckFailure -> State a -> State a addFail CheckFailure :: RuleCode -> DLSeverity -> Text -> Linenumber -> CheckFailure CheckFailure {Linenumber Text RuleCode DLSeverity line :: Linenumber message :: Text severity :: DLSeverity code :: RuleCode line :: Linenumber message :: Text severity :: DLSeverity code :: RuleCode ..} {-# INLINEABLE rule #-}