module Hadolint.Rule.DL3035 (rule) where

import Hadolint.Rule
import qualified Hadolint.Shell as Shell
import Language.Docker.Syntax


rule :: Rule Shell.ParsedShell
rule :: Rule ParsedShell
rule = Rule ParsedShell
dl3035 forall a. Semigroup a => a -> a -> a
<> forall args. Rule args -> Rule args
onbuild Rule ParsedShell
dl3035
{-# INLINEABLE rule #-}

dl3035 :: Rule Shell.ParsedShell
dl3035 :: Rule ParsedShell
dl3035 = forall args.
RuleCode
-> DLSeverity -> Text -> (Instruction args -> Bool) -> Rule args
simpleRule RuleCode
code DLSeverity
severity Text
message Instruction ParsedShell -> Bool
check
  where
    code :: RuleCode
code = RuleCode
"DL3035"
    severity :: DLSeverity
severity = DLSeverity
DLWarningC
    message :: Text
message = Text
"Do not use `zypper dist-upgrade`."

    check :: Instruction ParsedShell -> Bool
check (Run (RunArgs Arguments ParsedShell
args RunFlags
_)) =
      forall a b. (a -> b) -> Arguments a -> b
foldArguments
        ( (Command -> Bool) -> ParsedShell -> Bool
Shell.noCommands
            ( Text -> [Text] -> Command -> Bool
Shell.cmdHasArgs
                Text
"zypper"
                [ Text
"dist-upgrade",
                  Text
"dup"
                ]
            )
        )
        Arguments ParsedShell
args
    check Instruction ParsedShell
_ = Bool
True
{-# INLINEABLE dl3035 #-}