From 0aaab394f663984fdd9d6e09e11937226c4375e6 Mon Sep 17 00:00:00 2001 From: Remy Suen Date: Sun, 19 Aug 2018 08:31:34 -0400 Subject: [PATCH] Fix #228 Warn if WORKDIR is not an absolute path 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 --- CHANGELOG.md | 1 + package-lock.json | 24 ++++++++++++------------ package.json | 2 +- src/server.ts | 8 ++++++-- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb4999..c3c8f38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/package-lock.json b/package-lock.json index a96a847..283ab0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -83,26 +83,26 @@ } }, "dockerfile-utils": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/dockerfile-utils/-/dockerfile-utils-0.0.8.tgz", - "integrity": "sha512-EPKPIbMK638M6O3Gw9H+QOWiRBNC3apnyL7FsgJsHV1YpJXRFQz2TDW424S8gsqhvDwbtHdLURiH2mvymNAziQ==", + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/dockerfile-utils/-/dockerfile-utils-0.0.11.tgz", + "integrity": "sha512-LNdPIgcl58343dF4KNCHvFzUScUhgLI9BRAR+Vln6D1tVBGvv1k5/qHuxWRCAM2uyFbj73QVkKMScXPhY7TqfQ==", "requires": { - "dockerfile-ast": "0.0.4", - "vscode-languageserver-types": "3.5.0" + "dockerfile-ast": "0.0.12", + "vscode-languageserver-types": "3.6.0" }, "dependencies": { "dockerfile-ast": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/dockerfile-ast/-/dockerfile-ast-0.0.4.tgz", - "integrity": "sha512-eOmS/ygp2tGOiUrBW7XcHqYeUhHePjxCTpboS6tbXA3nE5be78QxdhzM9fSR7paKAIq2xaV5eSVsEixUNVk9bQ==", + "version": "0.0.12", + "resolved": "https://registry.npmjs.org/dockerfile-ast/-/dockerfile-ast-0.0.12.tgz", + "integrity": "sha512-cIV8oXkAxpIuN5XgG0TGg07nLDgrj4olkfrdT77OTA3VypscsYHBUg/FjHxW9K3oA+CyH4Th/qtoMgTVpzSobw==", "requires": { - "vscode-languageserver-types": "3.5.0" + "vscode-languageserver-types": "3.6.0" } }, "vscode-languageserver-types": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.5.0.tgz", - "integrity": "sha1-5I15li8LjgLelV4/UkkI4rGcA3Q=" + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.6.0.tgz", + "integrity": "sha512-GSgQtGmtza4PoNH0+iHWylWg/1sw2DODezqYWRxbN910dPchI3CQaSJN76csKcQGv55wsWgX82T6n74q8mFSpw==" } } }, diff --git a/package.json b/package.json index 2f95b87..4325ff2 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/server.ts b/src/server.ts index d11d3ae..98f3862 100644 --- a/src/server.ts +++ b/src/server.ts @@ -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); @@ -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, @@ -244,7 +246,8 @@ function convertValidatorConfiguration(config: ValidatorConfiguration): Validato instructionCmdMultiple, instructionEntrypointMultiple, instructionHealthcheckMultiple, - instructionJSONInSingleQuotes + instructionJSONInSingleQuotes, + instructionWorkdirRelative }; } @@ -269,7 +272,8 @@ interface ValidatorConfiguration { instructionCmdMultiple?: string, instructionEntrypointMultiple?: string, instructionHealthcheckMultiple?: string, - instructionJSONInSingleQuotes?: string + instructionJSONInSingleQuotes?: string, + instructionWorkdirRelative?: string } interface Settings {