dockerfilelint
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.4.0"></a> | ||
# [1.4.0](https://github.com/replicatedhq/dockerfilelint/compare/v1.3.0...v1.4.0) (2017-09-13) | ||
### Features | ||
* support for multi-stage builds ([#84](https://github.com/replicatedhq/dockerfilelint/issues/84)) ([72d2087](https://github.com/replicatedhq/dockerfilelint/commit/72d2087)) | ||
<a name="1.3.0"></a> | ||
@@ -7,0 +17,0 @@ # [1.3.0](https://github.com/replicatedhq/dockerfilelint/compare/v1.2.0...v1.3.0) (2017-09-12) |
@@ -53,4 +53,6 @@ 'use strict'; | ||
var state = { | ||
instructionsProcessed: 0, | ||
cmdFound: false, | ||
stages: [{ | ||
instructionsProcessed: 0, | ||
cmdFound: false // this doesn't seem to be used anywhere | ||
}], | ||
items: [], | ||
@@ -66,7 +68,13 @@ rules: loadRules(configPath) | ||
if (result.command === 'cmd') { | ||
state.cmdFound = true; | ||
state.stages[state.stages.length - 1].cmdFound = true; | ||
} else if (result.command === 'from' && state.stages[state.stages.length - 1].instructionsProcessed !== 0) { | ||
// Each FROM command constitutes a new stage in a multistage build | ||
state.stages.push({ | ||
instructionsProcessed: 0, | ||
cmdFound: false | ||
}); | ||
} | ||
// And we also care about knowing if this is the first command or not | ||
state.instructionsProcessed = state.instructionsProcessed + 1; | ||
state.stages[state.stages.length - 1].instructionsProcessed++; | ||
}; | ||
@@ -121,3 +129,3 @@ | ||
// but is not the time (non blank, non commented) line | ||
if ((state.instructionsProcessed === 0 && cmd !== 'from') || (state.instructionsProcessed !== 0 && cmd === 'from')) { | ||
if (state.stages[state.stages.length - 1].instructionsProcessed === 0 && cmd !== 'from') { | ||
items.push(messages.build(state.rules, 'from_first', line)); | ||
@@ -124,0 +132,0 @@ } |
{ | ||
"name": "dockerfilelint", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "A linter for Dockerfiles to find bugs and encourage best practices", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137534
1043