diff --git a/README.md b/README.md index deb221d..34c4e6e 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,12 @@ > A simple (CLI) tool to lint YAML files -[![Build Status](https://travis-ci.org/rasshofer/yaml-lint.svg)](https://travis-ci.org/rasshofer/yaml-lint) -[![Dependency Status](https://david-dm.org/rasshofer/yaml-lint/status.svg)](https://david-dm.org/rasshofer/yaml-lint) -[![Dependency Status](https://david-dm.org/rasshofer/yaml-lint/dev-status.svg)](https://david-dm.org/rasshofer/yaml-lint) +[![Build Status](https://img.shields.io/travis/rasshofer/yaml-lint.svg?style=flat-square)](https://travis-ci.org/rasshofer/yaml-lint) +[![Dependency Status](https://img.shields.io/david/rasshofer/yaml-lint.svg?style=flat-square)](https://david-dm.org/rasshofer/yaml-lint) +[![Dev Dependency Status](https://img.shields.io/david/dev/rasshofer/yaml-lint.svg?style=flat-square)](https://david-dm.org/rasshofer/yaml-lint) +[![Version](https://img.shields.io/npm/v/yaml-lint.svg?style=flat-square)](https://www.npmjs.com/package/yaml-lint) +[![Month Download](https://img.shields.io/npm/dm/yaml-lint.svg?style=flat-square)](https://www.npmjs.com/package/yaml-lint) +[![License](https://img.shields.io/npm/l/yaml-lint.svg?style=flat-square)](https://www.npmjs.com/package/yaml-lint) ## Usage @@ -44,6 +47,16 @@ $ yamllint test.yaml - `CORE_SCHEMA` Same as `JSON_SCHEMA` ([http://www.yaml.org/spec/1.2/spec.html#id2804923](http://www.yaml.org/spec/1.2/spec.html#id2804923)) - `DEFAULT_SAFE_SCHEMA` All supported YAML types, without unsafe ones (`!!js/undefined`, `!!js/regexp`, and `!!js/function`) ([http://yaml.org/type/](http://yaml.org/type/)) +### `ignore-path` (string) + +> Specifies a glob or globs to ignore + +Sample: + +```shell +$ yamllint **/*.(yaml|yml) --ignore-path=foobar.yml --ignore-path=dir/*.yaml +``` + ## Changelog * 1.1.0 diff --git a/cli.js b/cli.js old mode 100644 new mode 100755 index 348ec6b..7a86d87 --- a/cli.js +++ b/cli.js @@ -2,10 +2,10 @@ const path = require('path'); const nconf = require('nconf'); -const yamlLint = require('./yaml-lint'); const leprechaun = require('leprechaun'); const snakeCase = require('lodash.snakecase'); const glob = require('glob'); +const yamlLint = require('./yaml-lint'); const options = {}; @@ -16,7 +16,8 @@ nconf.argv().env({ }); [ - 'schema' + 'schema', + 'ignorePath' ].forEach((key) => { const env = snakeCase(key); options[key] = nconf.get(key) || nconf.get('yamllint_' + env.toLowerCase()) || nconf.get('YAMLLINT' + env.toUpperCase()); @@ -26,8 +27,12 @@ const config = nconf.get(); let files = []; -(config._ || []).forEach((file) => { - files = files.concat(glob.sync(file)); +(config._ || []).forEach((pattern) => { + files = files.concat(glob.sync(pattern, { + nocase: true, + dot: true, + ignore: config.ignorePath + })); }); if (files.length === 0) { diff --git a/package-lock.json b/package-lock.json index cfb3f9c..e626b20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -477,9 +477,9 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.17.0.tgz", - "integrity": "sha512-AyxBUCANU/o/xC0ijGMKavo5Ls3oK6xykiOITlMdjFjrKOsqLrA7Nf5cnrDgcKrHzBirclAZt63XO7YZlVUPwA==", + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.18.1.tgz", + "integrity": "sha512-gPSfpSRCHre1GLxGmO68tZNxOlL2y7xBd95VcLD+Eo4S2js31YoMum3CAQIOaxY24hqYOMksMvW38xuuWKQTgw==", "dev": true, "requires": { "ajv": "5.5.2", @@ -743,7 +743,7 @@ "requires": { "asynckit": "0.4.0", "combined-stream": "1.0.6", - "mime-types": "2.1.17" + "mime-types": "2.1.18" } }, "fs-exists-cached": { @@ -1259,18 +1259,18 @@ } }, "mime-db": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", "dev": true }, "mime-types": { - "version": "2.1.17", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", - "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", "dev": true, "requires": { - "mime-db": "1.30.0" + "mime-db": "1.33.0" } }, "mimic-fn": { @@ -3139,7 +3139,7 @@ "is-typedarray": "1.0.0", "isstream": "0.1.2", "json-stringify-safe": "5.0.1", - "mime-types": "2.1.17", + "mime-types": "2.1.18", "oauth-sign": "0.8.2", "qs": "6.3.2", "stringstream": "0.0.5", @@ -3442,9 +3442,9 @@ } }, "tap": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/tap/-/tap-11.1.0.tgz", - "integrity": "sha512-ya7vl9gx+XFQn5K+Va/4AFz5U8ISAG22k6o+UoZAnX3Bx6uCwNtrsEzVvXjhOK2J+VybFHaReOF0TITDoCKSTQ==", + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/tap/-/tap-11.1.1.tgz", + "integrity": "sha512-XpXmLJlDpPrGsaEJlpSV7u16kR/jaPUf5XyzdL59l8KsLNFSmQKH4qCEBKy9y+OCku9ee77NvobCsZLpK8ruZg==", "dev": true, "requires": { "bind-obj-methods": "1.0.0",