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

@keptn/pitometer-grader-threshold

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@keptn/pitometer-grader-threshold - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.nyc_output/33044c1a-c513-4446-ae0c-e8eeef009113.json

1

dist/classes/Grader.d.ts

@@ -20,2 +20,3 @@ /**

setOptions(options: pitometer.IOptions): void;
getContext(): string;
private evaluate;

@@ -22,0 +23,0 @@ grade(id: string, results: pitometer.ISourceResult[], { thresholds, metricScore, ignoreEmpty }: {

43

dist/classes/Grader.js

@@ -22,18 +22,6 @@ "use strict";

}
getContext() {
return this.context;
}
evaluate(result, { thresholds, metricScore, ignoreEmpty }) {
if ((typeof (result) === 'boolean') || !result.value) {
if (ignoreEmpty) {
return false;
}
return {
score: 0,
violations: [
{
key: typeof (result) === 'boolean' ? '' : result.key,
value: false,
breach: 'The indicator returned no value for the current key',
},
],
};
}
let score = metricScore;

@@ -84,9 +72,2 @@ const violations = [];

grade(id, results, { thresholds, metricScore, ignoreEmpty }) {
if (!results) {
return {
id,
score: 0,
violations: [{ breach: 'The indicator returned no values' }],
};
}
const grades = [];

@@ -96,4 +77,2 @@ const violations = [];

const grade = this.evaluate(result, { thresholds, metricScore, ignoreEmpty });
if (grade === false)
return false;
violations.push(...grade.violations);

@@ -110,5 +89,17 @@ grades.push({

return (!acc || elm.score < acc.score) ? elm : acc;
return acc;
// tslint:disable-next-line: align
}, null);
return { id, violations, score: reduced ? reduced.score : metricScore };
let score = 0;
if (reduced) {
score = reduced.score;
}
else if (ignoreEmpty) {
score = metricScore;
}
else {
violations.push({
breach: 'The indicator returned no values',
});
}
return { id, violations, score };
}

@@ -115,0 +106,0 @@ }

{
"name": "@keptn/pitometer-grader-threshold",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -9,3 +9,3 @@ "main": "./dist/index.js",

"build": "npx tsc",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Testing...\" && nyc --reporter=text nyc mocha && nyc report"
},

@@ -16,8 +16,36 @@ "keywords": [],

"devDependencies": {
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.6",
"@types/node": "^11.13.2",
"chai": "^4.2.0",
"mocha": "^6.1.4",
"nyc": "^14.1.1",
"pitometer": "file:../pitometer",
"source-map-support": "^0.5.12",
"ts-node": "^8.1.0",
"tslint": "^5.15.0",
"tslint-config-airbnb": "^5.11.1",
"typescript": "^3.4.2"
},
"nyc": {
"include": [
"src/**/*.ts"
],
"exclude": [
"src/server.ts",
"src/**/*.spec.ts"
],
"extension": [
".ts"
],
"require": [
"ts-node/register"
],
"reporter": [
"html",
"cobertura"
],
"sourceMap": true,
"instrument": true
}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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