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

@boll/core

Package Overview
Dependencies
Maintainers
3
Versions
1225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boll/core - npm Package Compare versions

Comparing version 1.5.2 to 1.6.0

dist/tests/result.test.d.ts

17

CHANGELOG.json

@@ -5,3 +5,18 @@ {

{
"date": "Tue, 01 Dec 2020 22:03:54 GMT",
"date": "Tue, 15 Dec 2020 17:21:35 GMT",
"tag": "@boll/core_v1.6.0",
"version": "1.6.0",
"comments": {
"minor": [
{
"comment": "Configurable warnings",
"author": "jdh@microsoft.com",
"commit": "8d628bb761b41874e8188e93b6163472231df3af",
"package": "@boll/core"
}
]
}
},
{
"date": "Tue, 01 Dec 2020 22:04:49 GMT",
"tag": "@boll/core_v1.5.2",

@@ -8,0 +23,0 @@ "version": "1.5.2",

# Change Log - @boll/core
This log was last generated on Tue, 01 Dec 2020 22:03:54 GMT and should not be manually modified.
This log was last generated on Tue, 15 Dec 2020 17:21:35 GMT and should not be manually modified.
<!-- Start content -->
## 1.6.0
Tue, 15 Dec 2020 17:21:35 GMT
### Minor changes
- Configurable warnings (jdh@microsoft.com)
## 1.5.2
Tue, 01 Dec 2020 22:03:54 GMT
Tue, 01 Dec 2020 22:04:49 GMT

@@ -11,0 +19,0 @@ ### Patches

3

dist/config.js

@@ -118,3 +118,4 @@ "use strict";

var options = __assign(__assign({}, check.options), optionsFromConfig);
return _this.ruleRegistry.get(check.rule)(_this.logger, options);
var rule = _this.ruleRegistry.get(check.rule)(_this.logger, options);
return new rule_set_1.InstantiatedPackageRule(rule.name, check.severity || "error", rule);
});

@@ -121,0 +122,0 @@ return new rule_set_1.RuleSet(glob, checks);

@@ -112,6 +112,5 @@ "use strict";

return this._ignoredChecksByLine;
this.source.forEachChild(function (n) {
this.content.split(/\r?\n/).forEach(function (n, lineNumber) {
var _a;
var lineNumber = _this.source.getLineAndCharacterOfPosition(n.pos).line;
var trimmedNodeText = n.getFullText().trim();
var trimmedNodeText = n.trim();
var ignoredChecks = [];

@@ -128,3 +127,4 @@ (_a = trimmedNodeText.match(/boll-disable-next-line.*/g)) === null || _a === void 0 ? void 0 : _a.forEach(function (line) {

if (ignoredChecks.length > 0)
_this._ignoredChecksByLine.set(lineNumber, ignoredChecks);
_this._ignoredChecksByLine.set(lineNumber + 1, ignoredChecks);
lineNumber = lineNumber + 1;
});

@@ -131,0 +131,0 @@ this._parsedIgnoreChecksByLine = true;

@@ -25,4 +25,7 @@ import { BollFile } from "./boll-file";

errors: Result[];
warnings: Result[];
get hasErrors(): boolean;
add(results: Result[]): void;
get hasWarnings(): boolean;
addErrors(results: Result[]): void;
addWarnings(results: Result[]): void;
}

@@ -53,2 +53,3 @@ "use strict";

this.errors = [];
this.warnings = [];
}

@@ -62,3 +63,10 @@ Object.defineProperty(ResultSet.prototype, "hasErrors", {

});
ResultSet.prototype.add = function (results) {
Object.defineProperty(ResultSet.prototype, "hasWarnings", {
get: function () {
return this.warnings.length > 0;
},
enumerable: false,
configurable: true
});
ResultSet.prototype.addErrors = function (results) {
var _this = this;

@@ -71,4 +79,12 @@ results.forEach(function (result) {

};
ResultSet.prototype.addWarnings = function (results) {
var _this = this;
results.forEach(function (result) {
if (result.status === types_1.ResultStatus.failure) {
_this.warnings.push(result);
}
});
};
return ResultSet;
}());
exports.ResultSet = ResultSet;

@@ -1,6 +0,15 @@

import { FileGlob, PackageRule } from "./types";
import { FileContext } from "./file-context";
import { Result } from "./result-set";
import { CheckSeverity, FileGlob, PackageRule } from "./types";
export declare class InstantiatedPackageRule {
name: string;
severity: CheckSeverity;
rule: PackageRule;
constructor(name: string, severity: CheckSeverity, rule: PackageRule);
check(file: FileContext): Promise<Result[]>;
}
export declare class RuleSet {
fileGlob: FileGlob;
checks: PackageRule[];
constructor(fileGlob: FileGlob, checks: PackageRule[]);
checks: InstantiatedPackageRule[];
constructor(fileGlob: FileGlob, checks: InstantiatedPackageRule[]);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RuleSet = void 0;
exports.RuleSet = exports.InstantiatedPackageRule = void 0;
var InstantiatedPackageRule = /** @class */ (function () {
function InstantiatedPackageRule(name, severity, rule) {
this.name = name;
this.severity = severity;
this.rule = rule;
}
InstantiatedPackageRule.prototype.check = function (file) {
return this.rule.check(file);
};
return InstantiatedPackageRule;
}());
exports.InstantiatedPackageRule = InstantiatedPackageRule;
var RuleSet = /** @class */ (function () {

@@ -5,0 +17,0 @@ function RuleSet(fileGlob, checks) {

@@ -0,3 +1,4 @@

import { FileContext } from "./file-context";
import { Logger } from "./logger";
import { ResultSet } from "./result-set";
import { Result, ResultSet } from "./result-set";
import { RuleSet } from "./rule-set";

@@ -11,2 +12,3 @@ export declare class Suite {

private loadPackage;
filterIgnoredChecksByLine(results: Result[], sourceFile: FileContext): Promise<Result[]>;
}

@@ -49,2 +49,3 @@ "use strict";

var result_set_1 = require("./result-set");
var types_1 = require("./types");
var util_1 = require("util");

@@ -106,3 +107,3 @@ var readFileAsync = util_1.promisify(fs_1.default.readFile);

sourceFiles.forEach(function (s) { return __awaiter(_this, void 0, void 0, function () {
var results;
var results, filteredResults;
return __generator(this, function (_a) {

@@ -116,3 +117,14 @@ switch (_a.label) {

results = _a.sent();
resultSet.add(results);
return [4 /*yield*/, this.filterIgnoredChecksByLine(results, s)];
case 2:
filteredResults = _a.sent();
if (r.severity === "error") {
resultSet.addErrors(filteredResults);
}
else if (r.severity === "warn") {
resultSet.addWarnings(filteredResults);
}
else {
throw new Error("Unknown severity! (This is likely a boll bug)");
}
return [2 /*return*/];

@@ -153,4 +165,24 @@ }

};
Suite.prototype.filterIgnoredChecksByLine = function (results, sourceFile) {
return __awaiter(this, void 0, void 0, function () {
var ignoredChecksByLine, filteredResults;
return __generator(this, function (_a) {
ignoredChecksByLine = sourceFile.ignoredChecksByLine;
filteredResults = [];
results.forEach(function (l) {
var _a;
if (l.status === types_1.ResultStatus.failure) {
var failure = l;
var skipLineNumber = failure.line - 1;
if (!(ignoredChecksByLine.has(skipLineNumber) && ((_a = ignoredChecksByLine.get(skipLineNumber)) === null || _a === void 0 ? void 0 : _a.includes(failure.ruleName)))) {
filteredResults.push(l);
}
}
});
return [2 /*return*/, filteredResults];
});
});
};
return Suite;
}());
exports.Suite = Suite;

@@ -10,2 +10,4 @@ "use strict";

var pragma_test_1 = require("./pragma.test");
test_internal_1.suite(config_test_1.test, format_test_1.test, git_utils_test_1.test, glob_test_1.test, ignore_test_1.test, pragma_test_1.test);
var result_test_1 = require("./result.test");
var suite_test_1 = require("./suite.test");
test_internal_1.suite(config_test_1.test, format_test_1.test, git_utils_test_1.test, glob_test_1.test, ignore_test_1.test, pragma_test_1.test, suite_test_1.test, result_test_1.test);

@@ -171,3 +171,3 @@ "use strict";

suite = _a.sent();
fakeRuleInstance = suite.ruleSets[0].checks[0];
fakeRuleInstance = suite.ruleSets[0].checks[0].rule;
assert.deepStrictEqual(fakeRuleInstance.options, { bar: "baz", some: "rule" });

@@ -174,0 +174,0 @@ return [2 /*return*/];

@@ -110,3 +110,3 @@ "use strict";

}); });
exports.test("should keep track of a disabled next line rules in a FileContext", function () { return __awaiter(void 0, void 0, void 0, function () {
exports.test("should keep track of a disabled next line rule in a FileContext", function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {

@@ -122,3 +122,3 @@ switch (_a.label) {

expectedResult = new Map();
expectedResult.set(1, ["MadeUpCheckName"]);
expectedResult.set(3, ["MadeUpCheckName"]);
assert.deepStrictEqual(sut.ignoredChecksByLine, expectedResult);

@@ -146,4 +146,4 @@ return [2 /*return*/];

expectedResult = new Map();
expectedResult.set(0, ["MadeUpCheckName", "AlsoMadeUpName"]);
expectedResult.set(2, ["MadeUpCheckName"]);
expectedResult.set(1, ["MadeUpCheckName", "AlsoMadeUpName"]);
expectedResult.set(4, ["MadeUpCheckName"]);
assert.deepStrictEqual(sut.ignoredChecksByLine, expectedResult);

@@ -150,0 +150,0 @@ return [2 /*return*/];

@@ -6,2 +6,3 @@ import { BollFile } from "./boll-file";

rule: string;
severity?: "warn" | "error";
options?: {};

@@ -48,1 +49,2 @@ }

}
export declare type CheckSeverity = "warn" | "error";

@@ -48,3 +48,3 @@ {

},
"version": "1.5.2"
"version": "1.6.0"
}
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