Azure/arc-cicd-demo-src

hadolint2junitxml.py throwing json.decoder.JSONDecodeError

ashugthub opened this issue · 1 comments

I got hadolint result in a file having below data
[{"line":1,"code":"DL3006","message":"Always tag the version of an image explicitly","column":1,"file":"Dockerfile","level":"warning"},{"line":2,"code":"DL3015","message":"Avoid additional packages by specifying --no-install-recommends","column":1,"file":"Dockerfile","level":"info"},{"line":2,"code":"DL3009","message":"Delete the apt-get lists after installing something","column":1,"file":"Dockerfile","level":"info"},{"line":2,"code":"SC2154","message":"node_verion is referenced but not assigned (did you mean 'node_version'?).","column":1,"file":"Dockerfile","level":"warning"},{"line":4,"code":"DL3045","message":"COPY to a relative destination without WORKDIR set.","column":1,"file":"Dockerfile","level":"warning"},{"line":5,"code":"DL3003","message":"Use WORKDIR to switch to a directory","column":1,"file":"Dockerfile","level":"warning"},{"line":5,"code":"DL3016","message":"Pin versions in npm. Instead of npm install <package> use npm install <package>@<version>","column":1,"file":"Dockerfile","level":"warning"},{"line":8,"code":"DL3011","message":"Valid UNIX ports range from 0 to 65535","column":1,"file":"Dockerfile","level":"error"}]

The py function always thows error . I guess there is a prblem with json.loads in hadolint2junitxml.py

I had to modify the hadolint2junitxml.py the file to use json.load instead of reading from stndin and resolved the issue