acbs-tree-lint
Advanced tools
Comparing version 1.0.2 to 1.0.3
const lint_spec = function (args) { | ||
const fs = require('fs'); | ||
const chalk = require('chalk'); | ||
const mylog = require('./mylog.js'); | ||
@@ -68,3 +69,8 @@ const config = {}; | ||
args.dirsl2.forEach(function (dirl2, i) { | ||
const padright = function (str, len, pad) { | ||
return (str.length === len) ? str : (str + (new Array(Math.max(3, len-str.length))).fill(pad).join('')); | ||
}; | ||
let path = `${dirl2}/spec`; | ||
let pkgidBasic = dirl2.slice(2); | ||
let pkgid = padright(chalk.bold(pkgidBasic), 40+8, ' '); | ||
fs.readFile(path, function (err, stdin, stderr) { | ||
@@ -108,11 +114,11 @@ if (err) { | ||
if (config.AttrDeprecated.includes(line.attr)) { | ||
mylog.warn(`${path}: Prop ${line.attr} is deprecated.`); | ||
mylog.warn(`${pkgid} Prop ${line.attr} is deprecated.`); | ||
}; | ||
// Rare attr | ||
if (config.AttrOrder.indexOf(line.attr) === -1) { | ||
// mylog.warn(`${path}: Prop ${line.attr} is rare.`); | ||
// mylog.warn(`${pkgid} Prop ${line.attr} is rare.`); | ||
}; | ||
// Conflict | ||
if (config.AttrConflictGroups.map(x => x.join(',')).join(',').split(',').includes(line.attr)) { | ||
// console.log(`${path}: ${line.attr} is seen.`); | ||
// console.log(`${pkgid} ${line.attr} is seen.`); | ||
let whichConflictGroup = null; | ||
@@ -126,3 +132,3 @@ config.AttrConflictGroups.forEach(function (group, groupId) { | ||
if (foundAttrs.includes(conflictCandidate)) { | ||
mylog.fail(`${path}: ${line.attr} conflicts with ${conflictCandidate}.`); | ||
mylog.fail(`${pkgid} ${line.attr} conflicts with ${conflictCandidate}.`); | ||
}; | ||
@@ -139,3 +145,3 @@ }) | ||
// Any of the seen attrs appears in `attrMustBeBefore` | ||
// mylog.info(`${path}: Better place ${line.attr} before ${attrEntry}.`); | ||
// mylog.info(`${pkgid} Better place ${line.attr} before ${attrEntry}.`); | ||
}; | ||
@@ -164,3 +170,3 @@ }); | ||
if (seenAttrs.indexOf(citedVar) === -1) { | ||
mylog.fail(`${path}: ${line.attr} citing undefined ${citedVar}.`); | ||
mylog.fail(`${pkgid} ${line.attr} citing undefined ${citedVar}.`); | ||
}; | ||
@@ -180,5 +186,5 @@ knownDependencyProblems.forEach(function (item) { | ||
if (item.solved) { | ||
mylog.info(`${path}: ${item.from} has unmet dependency but is used later by ${item.citedVar}.`) | ||
mylog.info(`${pkgid} ${item.from} has unmet dependency but is used later by ${item.citedVar}.`) | ||
} else { | ||
mylog.fail(`${path}: ${item.from} depends on ${item.to}.`) | ||
mylog.fail(`${pkgid} ${item.from} depends on ${item.to}.`) | ||
}; | ||
@@ -185,0 +191,0 @@ }); |
{ | ||
"name": "acbs-tree-lint", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "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
45420
261