module Hadolint.Rule.DL3063 (rule) where

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

rule :: Rule Shell.ParsedShell
rule :: Rule ParsedShell
rule = RuleCode
-> DLSeverity
-> Text
-> (Instruction ParsedShell -> Bool)
-> Rule ParsedShell
forall args.
RuleCode
-> DLSeverity -> Text -> (Instruction args -> Bool) -> Rule args
simpleRule RuleCode
code DLSeverity
severity Text
message Instruction ParsedShell -> Bool
forall {args}. Instruction args -> Bool
check
  where
    code :: RuleCode
code = RuleCode
"DL3063"
    severity :: DLSeverity
severity = DLSeverity
DLWarningC
    message :: Text
message = Text
"stage name should not be a reserved word"

    check :: Instruction args -> Bool
check (From BaseImage {alias :: BaseImage -> Maybe ImageAlias
alias = Just (ImageAlias Text
als)})
      | Text
als Text -> [Text] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Text
"scratch", Text
"context"] = Bool
False
      | Bool
otherwise = Bool
True
    check Instruction args
_ = Bool
True
{-# INLINEABLE rule #-}