Skip to content

Commit

Permalink
Fix #228 Warn if WORKDIR is not an absolute path
Browse files Browse the repository at this point in the history
Docker suggests using absolute paths for WORKDIR instructions for
clarity and reliability. A diagnostic will now be published if a
WORKDIR instruction does not appear to be an absolute path.

Signed-off-by: Remy Suen <[email protected]>
  • Loading branch information
rcjsuen committed Aug 19, 2018
1 parent 7339d61 commit 0aaab39
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
- return code action literals if the client supports it ([#225](https://github.com/rcjsuen/dockerfile-language-server-nodejs/issues/225))
- textDocument/publishDiagnostics
- add support for SCTP in EXPOSE instruction ([rcjsuen/dockerfile-utils#52](https://github.com/rcjsuen/dockerfile-utils/issues/52))
- warn if WORKDIR is not an absolute path ([#228](https://github.com/rcjsuen/dockerfile-language-server-nodejs/issues/228))

### Changed
- [upgraded the dependency of Mocha](https://github.com/mochajs/mocha/issues/2791) from 3.x to 5.x
Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"dependencies": {
"dockerfile-language-service": "0.0.6",
"dockerfile-utils": "0.0.8",
"dockerfile-utils": "0.0.11",
"vscode-languageserver": "^4.4.0"
},
"devDependencies": {
Expand Down
8 changes: 6 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ function convertValidatorConfiguration(config: ValidatorConfiguration): Validato
let instructionEntrypointMultiple = ValidationSeverity.WARNING;
let instructionHealthcheckMultiple = ValidationSeverity.WARNING;
let instructionJSONInSingleQuotes = ValidationSeverity.WARNING;
let instructionWorkdirRelative = ValidationSeverity.WARNING;
if (config) {
deprecatedMaintainer = getSeverity(config.deprecatedMaintainer);
directiveCasing = getSeverity(config.directiveCasing);
Expand All @@ -235,6 +236,7 @@ function convertValidatorConfiguration(config: ValidatorConfiguration): Validato
instructionEntrypointMultiple = getSeverity(config.instructionEntrypointMultiple);
instructionHealthcheckMultiple = getSeverity(config.instructionHealthcheckMultiple);
instructionJSONInSingleQuotes = getSeverity(config.instructionJSONInSingleQuotes);
instructionWorkdirRelative = getSeverity(config.instructionWorkdirRelative);
}
return {
deprecatedMaintainer,
Expand All @@ -244,7 +246,8 @@ function convertValidatorConfiguration(config: ValidatorConfiguration): Validato
instructionCmdMultiple,
instructionEntrypointMultiple,
instructionHealthcheckMultiple,
instructionJSONInSingleQuotes
instructionJSONInSingleQuotes,
instructionWorkdirRelative
};
}

Expand All @@ -269,7 +272,8 @@ interface ValidatorConfiguration {
instructionCmdMultiple?: string,
instructionEntrypointMultiple?: string,
instructionHealthcheckMultiple?: string,
instructionJSONInSingleQuotes?: string
instructionJSONInSingleQuotes?: string,
instructionWorkdirRelative?: string
}

interface Settings {
Expand Down

0 comments on commit 0aaab39

Please sign in to comment.