Skip to content

Commit

Permalink
Fix #217 Fix COPY validation error with JSON folders
Browse files Browse the repository at this point in the history
If a COPY instruction is written in the JSON format but it is
incorrectly using single quotes instead of double quotes, a warning
should be generated. This warning can be toggled to become an error
or alternatively ignored by modifying the configuration of the
validator in the language server.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
  • Loading branch information
rcjsuen committed Apr 14, 2018
1 parent 4b5ca39 commit a0ee572
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 43 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
All notable changes to this project will be documented in this file.

## [Unreleased]
- settings
- docker.languageserver.diagnostics.instructionJSONInSingleQuotes? ([#217](https://github.com/rcjsuen/dockerfile-language-server-nodejs/issues/217))
- value = ( "ignore" | "warning" | "error" )

### Fixed
- clear diagnostics when server receives textDocument/didClose so that they do not linger in the client ([#214](https://github.com/rcjsuen/dockerfile-language-server-nodejs/issues/214))
- apply received changes in a textDocument/didChange in the order given in the JSON result instead of trying to sort them and apply them backwards ([#216](https://github.com/rcjsuen/dockerfile-language-server-nodejs/issues/216))
- textDocument/didChange
- apply received changes in a textDocument/didChange in the order given in the JSON result instead of trying to sort them and apply them backwards ([#216](https://github.com/rcjsuen/dockerfile-language-server-nodejs/issues/216))
- textDocument/publishDiagnostics
- clear diagnostics when server receives textDocument/didClose so that they do not linger in the client ([#214](https://github.com/rcjsuen/dockerfile-language-server-nodejs/issues/214))
- fix incorrect validation error if a COPY uses JSON arguments and its last string argument is correctly defined as a folder ([#217](https://github.com/rcjsuen/dockerfile-language-server-nodejs/issues/217))

## [0.0.14] - 2018-03-08
### Added
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ interface Settings {
instructionCmdMultiple?: string,
instructionEntrypointMultiple?: string
instructionHealthcheckMultiple?: string
instructionJSONInSingleQuotes?: string
}
}
}
Expand Down
48 changes: 11 additions & 37 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
},
"dependencies": {
"dockerfile-ast": "0.0.3",
"dockerfile-language-service": "0.0.2",
"dockerfile-utils": "0.0.6",
"dockerfile-language-service": "0.0.3",
"dockerfile-utils": "0.0.8",
"vscode-languageserver": "^4.0.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 @@ -156,6 +156,7 @@ function validateTextDocument(textDocument: TextDocument): void {
let instructionCmdMultiple = ValidationSeverity.WARNING;
let instructionEntrypointMultiple = ValidationSeverity.WARNING;
let instructionHealthcheckMultiple = ValidationSeverity.WARNING;
let instructionJSONInSingleQuotes = ValidationSeverity.WARNING;
if (config) {
maintainer = getSeverity(config.deprecatedMaintainer);
directiveCasing = getSeverity(config.directiveCasing);
Expand All @@ -164,6 +165,7 @@ function validateTextDocument(textDocument: TextDocument): void {
instructionCmdMultiple = getSeverity(config.instructionCmdMultiple);
instructionEntrypointMultiple = getSeverity(config.instructionEntrypointMultiple);
instructionHealthcheckMultiple = getSeverity(config.instructionHealthcheckMultiple);
instructionJSONInSingleQuotes = getSeverity(config.instructionHealthcheckMultiple);
}
const fileSettings = {
deprecatedMaintainer: maintainer,
Expand All @@ -172,7 +174,8 @@ function validateTextDocument(textDocument: TextDocument): void {
instructionCasing: instructionCasing,
instructionCmdMultiple: instructionCmdMultiple,
instructionEntrypointMultiple: instructionEntrypointMultiple,
instructionHealthcheckMultiple: instructionHealthcheckMultiple
instructionHealthcheckMultiple: instructionHealthcheckMultiple,
instructionJSONInSingleQuotes: instructionJSONInSingleQuotes
};
const diagnostics = service.validate(textDocument.getText(), fileSettings);
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
Expand All @@ -190,7 +193,8 @@ interface ValidatorConfiguration {
instructionCasing?: string,
instructionCmdMultiple?: string,
instructionEntrypointMultiple?: string,
instructionHealthcheckMultiple?: string
instructionHealthcheckMultiple?: string,
instructionJSONInSingleQuotes?: string
}

interface Settings {
Expand Down

0 comments on commit a0ee572

Please sign in to comment.