Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dockerlint

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dockerlint - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

LICENSE

2

lib/cli.js

@@ -16,3 +16,3 @@ // Generated by CoffeeScript 1.9.0

usage = function() {
console.log("Dockerlint " + meta["version"] + "\n\n \tusage: dockerlint [-hp] Dockerfile");
console.log("Dockerlint " + meta["version"] + "\n\n \tusage: dockerlint [-h] [-dp] -f Dockerfile");
return process.exit(0);

@@ -19,0 +19,0 @@ };

// Generated by CoffeeScript 1.9.0
(function() {
var args, fs, getArguments, getInstruction, utils;
var args, fs, utils;

@@ -18,3 +18,3 @@ args = require('subarg')(process.argv.slice(2), {

getInstruction = function(s) {
exports.getInstruction = function(s) {
var instruction;

@@ -29,27 +29,33 @@ instruction = s.split(' ')[0];

getArguments = function(s) {
exports.getArguments = function(s) {
var inst;
inst = getInstruction(s);
inst = this.getInstruction(s);
if (inst === 'comment') {
inst = '#';
}
return [s.replace(inst, '').replace('\\', '').trim()];
return [s.replace(inst, '').replace(/\\(\s*)$/, '').trim()];
};
exports.parser = function(dockerfile) {
var rules;
var rules, self;
rules = [];
self = this;
(function() {
var cont, line, lineno, rule, _i, _len, _ref, _results;
var cont, data, e, line, lineno, rule, _i, _len, _results;
lineno = 1;
cont = false;
rule = [];
_ref = fs.readFileSync(dockerfile).toString().split('\n');
try {
data = fs.readFileSync(dockerfile).toString().split('\n');
} catch (_error) {
e = _error;
return [];
}
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
line = _ref[_i];
for (_i = 0, _len = data.length; _i < _len; _i++) {
line = data[_i];
if (utils.notEmpty(line)) {
if (line.endsWith('\\')) {
if (cont) {
rule[0]["arguments"] = rule[0]["arguments"].concat(getArguments(line));
rule[0]["arguments"] = rule[0]["arguments"].concat(self.getArguments(line));
} else {

@@ -59,4 +65,4 @@ cont = true;

line: lineno,
instruction: getInstruction(line),
"arguments": getArguments(line)
instruction: self.getInstruction(line),
"arguments": self.getArguments(line)
});

@@ -68,3 +74,3 @@ }

instruction: rule[0].instruction,
"arguments": rule[0]["arguments"].concat(getArguments(line))
"arguments": rule[0]["arguments"].concat(self.getArguments(line))
});

@@ -76,4 +82,4 @@ rule = [];

line: lineno,
instruction: getInstruction(line),
"arguments": getArguments(line)
instruction: self.getInstruction(line),
"arguments": self.getArguments(line)
});

@@ -80,0 +86,0 @@ }

{
"name": "dockerlint",
"version": "0.1.0",
"version": "0.1.1",
"description": "Linting for Dockerfiles",

@@ -10,8 +10,8 @@ "main": "bin/dockerlint",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "make test"
},
"author": {
"name": "Jasper Lievisse Adriaanse",
"email": "jasper@redcoolbeans.com",
"url": "http://www.redcoolbeans.com"
"name": "Jasper Lievisse Adriaanse",
"email": "jasper@redcoolbeans.com",
"url": "http://www.redcoolbeans.com"
},

@@ -38,3 +38,6 @@ "license": "MIT",

"devDependencies": {
"coffee-script": "^1.9.0"
"chai": "^2.1.2",
"coffee-script": "^1.9.0",
"mocha": "^2.2.1",
"should": "^5.2.0"
},

@@ -41,0 +44,0 @@ "engines": {

@@ -6,5 +6,42 @@ # Dockerlint

## ToDo
## Install
With [npm](https://npmjs.org/) just do:
$ [sudo] npm install -g dockerlint
## Usage
Once installed it's as easy as:
dockerlint -f Dockerfile
Which will parse the file and notify you about any actual errors (such an
omitted tag when `:` is set), and warn you about common pitfalls or bad idiom
such as the common use case of `ADD`.
In order to treat warnings as errors, use the `-p` flag.
### Running from a git clone
If you've cloned this repository, you can run `dockerlint` with:
make deps # runs npm install
make js && coffee bin/dockerlint.coffee
## Roadmap
- Add support for --version which checks against a specific Docker version
- Move the rule specific functions into a Rule class
- Refactor code to move the rule specific functions into a Rule class
## License
MIT, please see the LICENSE file.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc