module Hadolint.Rule.DL3007 (rule) where

import Hadolint.Rule
import Language.Docker.Syntax

rule :: Rule args
rule :: Rule args
rule = RuleCode
-> DLSeverity -> Text -> (Instruction args -> Bool) -> Rule args
forall args.
RuleCode
-> DLSeverity -> Text -> (Instruction args -> Bool) -> Rule args
simpleRule RuleCode
code DLSeverity
severity Text
message Instruction args -> Bool
forall args. Instruction args -> Bool
check
  where
    code :: RuleCode
code = RuleCode
"DL3007"
    severity :: DLSeverity
severity = DLSeverity
DLWarningC
    message :: Text
message =
      Text
"Using latest is prone to errors if the image will ever update. Pin the version explicitly \
      \to a release tag"
    check :: Instruction args -> Bool
check (From BaseImage {$sel:tag:BaseImage :: BaseImage -> Maybe Tag
tag = Just Tag
t}) = Tag
t Tag -> Tag -> Bool
forall a. Eq a => a -> a -> Bool
/= Tag
"latest"
    check Instruction args
_ = Bool
True
{-# INLINEABLE rule #-}