@deepcode/tsc
Advanced tools
Comparing version 2.0.12 to 2.0.13
@@ -0,1 +1,4 @@ | ||
## [2.0.13] - 2020-12-01 | ||
- New fields related to CWE in analysis results | ||
## [2.0.12] - 2020-10-27 | ||
@@ -2,0 +5,0 @@ - Error-tolerant handling of issues with file access permissions |
@@ -13,3 +13,3 @@ "use strict"; | ||
const bundles_1 = require("./bundles"); | ||
const sarif_converter_1 = require("./sarif_converter"); | ||
const sarif_converter_1 = __importDefault(require("./sarif_converter")); | ||
const analysis_result_interface_1 = require("./interfaces/analysis-result.interface"); | ||
@@ -181,3 +181,3 @@ const sleep = (duration) => new Promise(resolve => setTimeout(resolve, duration)); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
result.sarifResults = sarif_converter_1.getSarif(analysisData.analysisResults); | ||
result.sarifResults = sarif_converter_1.default(analysisData.analysisResults); | ||
} | ||
@@ -184,0 +184,0 @@ return result; |
@@ -29,2 +29,5 @@ import { Log } from 'sarif'; | ||
exampleCommitFixes: ExampleCommitFix[]; | ||
cwe: string[]; | ||
title: string; | ||
text: string; | ||
} | ||
@@ -31,0 +34,0 @@ export interface ISuggestions { |
import { IAnalysisResult } from './interfaces/analysis-result.interface'; | ||
import { Log } from 'sarif'; | ||
export declare const getSarif: (analysisResults: IAnalysisResult) => Log; | ||
export default function getSarif(analysisResults: IAnalysisResult): Log; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSarif = void 0; | ||
const getSarif = (analysisResults) => { | ||
function getSarif(analysisResults) { | ||
const { tool, suggestions } = getTools(analysisResults, getSuggestions(analysisResults)); | ||
@@ -17,4 +16,4 @@ const results = getResults(suggestions); | ||
}; | ||
}; | ||
exports.getSarif = getSarif; | ||
} | ||
exports.default = getSarif; | ||
const getSuggestions = (analysisResults) => { | ||
@@ -32,2 +31,3 @@ const suggestions = {}; | ||
const getTools = (analysisResults, suggestions) => { | ||
var _a; | ||
const output = { driver: { name: 'DeepCode', semanticVersion: '1.0.0' } }; | ||
@@ -37,11 +37,7 @@ const rules = []; | ||
for (const [suggestionName, suggestion] of Object.entries(analysisResults.suggestions)) { | ||
let severity; | ||
const severityNum = suggestion.severity; | ||
if (severityNum > 0 && severityNum <= 3) { | ||
severity = { | ||
3: 'error', | ||
2: 'warning', | ||
1: 'note', | ||
}[severityNum]; | ||
} | ||
const severity = { | ||
1: 'note', | ||
2: 'warning', | ||
3: 'error', | ||
}[suggestion.severity]; | ||
const suggestionId = suggestion.id; | ||
@@ -52,7 +48,4 @@ const rule = { | ||
shortDescription: { | ||
text: suggestion.message, | ||
text: suggestion.title || suggestion.rule, | ||
}, | ||
fullDescription: { | ||
text: suggestion.message, | ||
}, | ||
defaultConfiguration: { | ||
@@ -62,3 +55,4 @@ level: severity, | ||
help: { | ||
text: suggestion.message, | ||
markdown: suggestion.text, | ||
text: '', | ||
}, | ||
@@ -70,2 +64,5 @@ properties: { | ||
}; | ||
if ((_a = suggestion.cwe) === null || _a === void 0 ? void 0 : _a.length) { | ||
rule.properties.cwe = suggestion.cwe; | ||
} | ||
rules.push(rule); | ||
@@ -80,3 +77,3 @@ suggestions[suggestionName] = { | ||
}; | ||
ruleIndex++; | ||
ruleIndex += 1; | ||
} | ||
@@ -83,0 +80,0 @@ return { tool: { driver: { ...output.driver, rules } }, suggestions }; |
{ | ||
"name": "@deepcode/tsc", | ||
"version": "2.0.12", | ||
"version": "2.0.13", | ||
"description": "Typescript consumer of Deepcode public API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
117736