dockerlint
Advanced tools
Comparing version 0.1.4 to 0.2.0
@@ -11,3 +11,3 @@ // Generated by CoffeeScript 1.9.0 | ||
exports.all = ['from_first', 'no_empty_tag', 'no_empty_digest', 'json_array_format', 'recommended_exec_form', 'json_array_even_quotes', 'json_array_brackets', 'add', 'multiple_entries', 'sudo', 'absolute_workdir', 'onbuild_copyadd', 'onbuild_disallowed', 'label_no_empty_value']; | ||
exports.all = ['from_first', 'no_empty_tag', 'no_empty_digest', 'json_array_brackets', 'json_array_even_quotes', 'json_array_format', 'recommended_exec_form', 'add', 'multiple_entries', 'sudo', 'absolute_workdir', 'onbuild_copyadd', 'onbuild_disallowed', 'label_no_empty_value']; | ||
@@ -82,3 +82,3 @@ Array.prototype.filter = function(func) { | ||
exports.json_array_format = function(rules) { | ||
var argument, i, r, rule, _i, _j, _k, _len, _len1, _len2, _ref, _ref1; | ||
var arg, argument, errmsg, i, r, rule, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2; | ||
_ref = ['CMD', 'ENTRYPOINT', 'RUN', 'VOLUME']; | ||
@@ -90,8 +90,21 @@ for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
r = rule[_j]; | ||
errmsg = "Arguments to " + i + " in exec for must not contain single quotes on line " + r.line; | ||
_ref1 = r["arguments"]; | ||
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) { | ||
argument = _ref1[_k]; | ||
if (argument.match(/\[.*'.*\]/)) { | ||
utils.log('ERROR', "Arguments to " + i + " in exec for must not contain single quotes on line " + r.line); | ||
return 'failed'; | ||
if (argument.match(/\[.*\]/)) { | ||
_ref2 = argument.split(','); | ||
for (_l = 0, _len3 = _ref2.length; _l < _len3; _l++) { | ||
arg = _ref2[_l]; | ||
utils.log('DEBUG', "Arg: " + arg); | ||
if (!arg.trim().match(/^\[?\".*\"\]?$/)) { | ||
utils.log('ERROR', errmsg); | ||
return 'failed'; | ||
} | ||
} | ||
} else { | ||
if (argument.match(/\[.*'.*\]/)) { | ||
utils.log('ERROR', errmsg); | ||
return 'failed'; | ||
} | ||
} | ||
@@ -98,0 +111,0 @@ } |
@@ -36,2 +36,3 @@ // Generated by CoffeeScript 1.9.0 | ||
dockerfile = args.file || args._[0] || 'Dockerfile'; | ||
dockerfile = dockerfile.toString(); | ||
if (!fs.existsSync(dockerfile)) { | ||
@@ -44,2 +45,5 @@ utils.log("FATAL", "Cannot open " + dockerfile + "."); | ||
rules = parser.parser(dockerfile); | ||
if (rules.length === 0) { | ||
utils.log("FATAL", dockerfile + " does not contain any instructions"); | ||
} | ||
if (args.debug) { | ||
@@ -52,2 +56,3 @@ utils.log('DEBUG', rules); | ||
check = _ref[_i]; | ||
console.log("check: " + check); | ||
if (checks[check](rules) === 'failed') { | ||
@@ -54,0 +59,0 @@ ok = false; |
@@ -47,3 +47,3 @@ // Generated by CoffeeScript 1.9.0 | ||
try { | ||
data = fs.readFileSync(dockerfile).toString().split('\n'); | ||
data = fs.readFileSync(dockerfile).toString().split(/\r?\n/); | ||
} catch (_error) { | ||
@@ -50,0 +50,0 @@ e = _error; |
{ | ||
"name": "dockerlint", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"description": "Linting for Dockerfiles", | ||
@@ -10,3 +10,4 @@ "main": "bin/dockerlint", | ||
"config": { | ||
"make": "make" | ||
"make": "make", | ||
"winmake": "mingw32-make.exe" | ||
}, | ||
@@ -16,4 +17,4 @@ "scripts": { | ||
"test": "make test", | ||
"build:win": "%npm_package_config_make% js", | ||
"test:win": "%npm_package_config_make% test" | ||
"build:win": "%npm_package_config_winmake% js", | ||
"test:win": "%npm_package_config_winmake% test" | ||
}, | ||
@@ -20,0 +21,0 @@ "author": { |
@@ -73,7 +73,7 @@ [![NPM](https://nodei.co/npm/dockerlint.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/dockerlint/) | ||
npm config set dockerlint:make "mingw32-make.exe" | ||
npm config set dockerlint:winmake "mingw32-make.exe" | ||
or pass it to every invocation: | ||
npm run build:win --dockerlint:make=mingw32-make.exe | ||
npm run build:win --dockerlint:winmake=mingw32-make.exe | ||
@@ -80,0 +80,0 @@ ## Roadmap |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
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
41079
489
1