Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline instructions with comment marker confuses Instruction's getArguments() #72

Closed
rcjsuen opened this issue Mar 8, 2020 · 0 comments
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Mar 8, 2020

RUN a \
b #c \
d

Given that comments must start at the beginning of a line in a Dockerfile, the above RUN instruction should have four arguments in total:

  1. a
  2. b
  3. #c
  4. d

However, we are only detecting two.

import { DockerfileParser } from 'dockerfile-ast';
let content =
    "RUN a \\\n" +
    "b #c \\\n" +
    "d";
let dockerfile = DockerfileParser.parse(
    content
);
let instruction = dockerfile.getInstructions()[0];
console.log(instruction.getArguments());
[ Argument { value: 'a', range: { start: [Object], end: [Object] } },
  Argument { value: 'b', range: { start: [Object], end: [Object] } } ]

Given that it stops after b, it seems like the #c bit is confusing the parser.

@rcjsuen rcjsuen added the bug label Mar 8, 2020
@rcjsuen rcjsuen self-assigned this Mar 8, 2020
@rcjsuen rcjsuen closed this as completed in 89dd3eb Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant