Skip to content

Commit

Permalink
Fix #77 Correct linting error ranges of multiline arguments
Browse files Browse the repository at this point in the history
Arguments that are flagged as being invalid but have parts of its
content preceded by an escape character will no longer have their
ranges calculated incorrectly in linting errors.

Signed-off-by: Remy Suen <[email protected]>
  • Loading branch information
rcjsuen committed Jun 18, 2020
1 parent fedaa40 commit d1ffecc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [Unreleased]
### Fixed
- correct ranges of linting errors if the error is on a multiline argument that is preceded by the escape character ([#77](https://github.com/rcjsuen/dockerfile-utils/issues/77))

## [0.0.16] - 2020-04-02
### Added
- RUN instructions with only flags and no arguments will now be raised as an error ([#76](https://github.com/rcjsuen/dockerfile-utils/issues/76))
Expand Down Expand Up @@ -137,6 +141,7 @@ All notable changes to this project will be documented in this file.
- create formatter for Dockerfiles
- create linter for Dockerfiles

[Unreleased]: https://github.com/rcjsuen/dockerfile-utils/compare/v0.0.16...HEAD
[0.0.16]: https://github.com/rcjsuen/dockerfile-utils/compare/v0.0.15...v0.0.16
[0.0.15]: https://github.com/rcjsuen/dockerfile-utils/compare/v0.0.14...v0.0.15
[0.0.14]: https://github.com/rcjsuen/dockerfile-utils/compare/v0.0.13...v0.0.14
Expand Down
6 changes: 3 additions & 3 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 @@ -27,7 +27,7 @@
"main": "./lib/main.js",
"types": "./lib/main.d.ts",
"dependencies": {
"dockerfile-ast": "0.0.25",
"dockerfile-ast": "0.0.26",
"vscode-languageserver-types": "3.6.0"
},
"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions test/dockerValidator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2361,6 +2361,14 @@ describe("Docker Validator Tests", function() {
assert.equal(diagnostics.length, 1);
assertCOPYDestinationNotDirectory(diagnostics[0], 1, 28, 1, 33);

diagnostics = validateDockerfile("FROM alpine\nCOPY a b /di\\\n\\\n\\r");
assert.equal(diagnostics.length, 1);
assertCOPYDestinationNotDirectory(diagnostics[0], 1, 9, 3, 2);

diagnostics = validateDockerfile("#escape=`\nFROM alpine\nCOPY a b /di`\n`\n`r");
assert.equal(diagnostics.length, 1);
assertCOPYDestinationNotDirectory(diagnostics[0], 2, 9, 4, 2);

diagnostics = validateDockerfile("#escape=`\nFROM microsoft/nanoserver\nCOPY Dockerfile Dockerfile2 C:\\tmp");
assert.equal(diagnostics.length, 1);
assertCOPYDestinationNotDirectory(diagnostics[0], 2, 28, 2, 34);
Expand Down

0 comments on commit d1ffecc

Please sign in to comment.