rcjsuen / dockerfile-language-service

Dockerfile language service for providing an API to create feature-rich Dockerfile editors in JavaScript.
MIT License
16 stars 2 forks source link

validate function does not consider the provided settings #18

Closed rcjsuen closed 6 years ago

rcjsuen commented 6 years ago
import { ValidationSeverity } from 'dockerfile-utils';
import { DockerfileLanguageServiceFactory } from 'dockerfile-language-service';

const file = `from node`;
const service = DockerfileLanguageServiceFactory.createLanguageService();
const problems = service.validate(file, { instructionCasing: ValidationSeverity.IGNORE });
console.log(JSON.stringify(problems));
$ node bug.js
[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":4}},"message":"Instructions should be written in uppercase letters","severity":2,"code":0,"source":"dockerfile-utils"}]

We should get an empty array because we have specified that the casing of instructions should be ignored but the problem is still reported. This is because we're not passing in the settings from the service's function to the validation function. https://github.com/rcjsuen/dockerfile-language-service/blob/fcd76cb978ea3572619b8be6e2956378f0d44505/src/languageService.ts#L92-L94