dockerfile_lint icon indicating copy to clipboard operation
dockerfile_lint copied to clipboard

TypeError: Cannot read property 'trim' of undefined

Open The-Compiler opened this issue 5 years ago • 0 comments

When dockerfile_lint is passed a file with a line ending with a backslash, but no second line, such as this:

test \

it fails with:

TypeError: Cannot read property 'trim' of undefined
    at Object.parse (.../node_modules/dockerfile_lint/lib/parser.js:457:40)
    at Linter.validate (.../node_modules/dockerfile_lint/lib/linter.js:106:27)
    at lint (.../node_modules/dockerfile_lint/bin/dockerfile_lint:120:36)
    at .../node_modules/dockerfile_lint/bin/dockerfile_lint:129:13
    at new Promise (<anonymous>)
    at lintDockerFile (.../node_modules/dockerfile_lint/bin/dockerfile_lint:107:12)
    at .../node_modules/dockerfile_lint/bin/dockerfile_lint:86:16
    at Function.map (.../node_modules/lodash/dist/lodash.js:3509:27)
    at lintDockerFiles (.../node_modules/dockerfile_lint/bin/dockerfile_lint:82:26)
    at Object.<anonymous> (.../node_modules/dockerfile_lint/bin/dockerfile_lint:172:5)

The easiest way to reproduce is probably (with bash): dockerfile_lint -f <(echo 'test \\')

The-Compiler avatar Dec 19 '20 18:12 The-Compiler