packages feed

hadolint 1.7.5 → 1.8.0

raw patch · 4 files changed

+40/−2 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Hadolint.Rules: useJsonArgs :: Rule

Files

README.md view
@@ -153,6 +153,7 @@ | [DL3022](https://github.com/hadolint/hadolint/wiki/DL3022)   | `COPY --from` should reference a previously defined `FROM` alias                                                                                    | | [DL3023](https://github.com/hadolint/hadolint/wiki/DL3023)   | `COPY --from` cannot reference its own `FROM` alias                                                                                                 | | [DL3024](https://github.com/hadolint/hadolint/wiki/DL3024)   | `FROM` aliases (stage names) must be unique                                                                                                         |+| [DL3025](https://github.com/hadolint/hadolint/wiki/DL3025)   | Use argumens JSON notation for CMD and ENTRYPOINT arguments                                                                                         | | [DL4000](https://github.com/hadolint/hadolint/wiki/DL4000)   | MAINTAINER is deprecated.                                                                                                                           | | [DL4001](https://github.com/hadolint/hadolint/wiki/DL4001)   | Either use Wget or Curl but not both.                                                                                                               | | [DL4003](https://github.com/hadolint/hadolint/wiki/DL4003)   | Multiple `CMD` instructions found.                                                                                                                  |
hadolint.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 91a172ca6bf1a65cb720378c6e3afd17c6f8ecaa619d9e2ca1f9b81e85c2d8a6+-- hash: ed40f7e723efb830715c051c8b06bf4693ace2a9f94c7a53e035fd1fc237febb  name:           hadolint-version:        1.7.5+version:        1.8.0 synopsis:       Dockerfile Linter JavaScript API description:    A smarter Dockerfile linter that helps you build best practice Docker images. category:       Development
src/Hadolint/Rules.hs view
@@ -174,6 +174,7 @@     , multipleCmds     , multipleEntrypoints     , useShell+    , useJsonArgs     ]  commentMetadata :: ShellCheck.Interface.Comment -> Metadata@@ -701,4 +702,14 @@     severity = WarningC     message = "Use SHELL to change the default shell"     check (Run args) = argumentsRule (Bash.noCommands (Bash.cmdHasArgs "ln" ["/bin/sh"])) args+    check _ = True++useJsonArgs :: Rule+useJsonArgs = instructionRule code severity message check+  where+    code = "DL3025"+    severity = WarningC+    message = "Use argumens JSON notation for CMD and ENTRYPOINT arguments"+    check (Cmd (ArgumentsText _ )) = False+    check (Entrypoint (ArgumentsText _ )) = False     check _ = True
test/Spec.hs view
@@ -730,6 +730,32 @@                 in do                   ruleCatchesNot copyFromAnother $ Text.unlines dockerFile                   ruleCatchesNot copyEndingSlash $ Text.unlines dockerFile+        --+        describe "JSON notation in ENTRYPOINT and CMD" $ do+            it "warn on ENTRYPOINT" $+                let dockerFile =+                        [ "FROM node as foo"+                        , "ENTRYPOINT something"+                        ]+                in ruleCatches useJsonArgs $ Text.unlines dockerFile+            it "don't warn on ENTRYPOINT json notation" $+                let dockerFile =+                        [ "FROM scratch as build"+                        , "ENTRYPOINT [\"foo\", \"bar\"]"+                        ]+                in ruleCatchesNot useJsonArgs $ Text.unlines dockerFile+            it "warn on CMD" $+                let dockerFile =+                        [ "FROM node as foo"+                        , "CMD something"+                        ]+                in ruleCatches useJsonArgs $ Text.unlines dockerFile+            it "don't warn on CMD json notation" $+                let dockerFile =+                        [ "FROM scratch as build"+                        , "CMD [\"foo\", \"bar\"]"+                        ]+                in ruleCatchesNot useJsonArgs $ Text.unlines dockerFile  assertChecks :: HasCallStack => Rule -> Text.Text -> ([RuleCheck] -> IO a) -> IO a assertChecks rule s makeAssertions =