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

@deepcode/tsc

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deepcode/tsc - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

8

dist/sarif_converter.d.ts
import { Log } from 'sarif';
import { IAnalysisResult } from './interfaces/analysis-result.interface';
export default function getSarif(analysisResults: IAnalysisResult): Log;
export declare function stringSplice(str: string, index: number, count: number, add?: string): string;
export declare function getArgumentsAndMessage(helpers: {
index: number[];
msg: number[];
}[], message: string): {
message: string;
argumentArray: string[];
};

52

dist/sarif_converter.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getArgumentsAndMessage = exports.stringSplice = void 0;
function getSarif(analysisResults) {

@@ -34,3 +35,3 @@ const { tool, suggestions } = getTools(analysisResults, getSuggestions(analysisResults));

var _a;
const output = { driver: { name: 'DeepCode', semanticVersion: '1.0.0' } };
const output = { driver: { name: 'SnykCode', semanticVersion: '1.0.0', version: '1.0.0' } };
const rules = [];

@@ -86,3 +87,4 @@ let ruleIndex = 0;

for (const [, suggestion] of Object.entries(suggestions)) {
const result = {
let helpers = [];
let result = {
ruleId: suggestion.id,

@@ -93,2 +95,4 @@ ruleIndex: suggestion.ruleIndex,

text: suggestion.text,
markdown: suggestion.text,
arguments: [''],
},

@@ -113,11 +117,19 @@ locations: [

const codeThreadFlows = [];
// let i = 0;
let i = 0;
if (suggestion.markers && suggestion.markers.length >= 1) {
for (const marker of suggestion.markers) {
for (const position of marker.pos) {
const helperIndex = helpers.findIndex(helper => helper.msg === marker.msg);
if (helperIndex != -1) {
helpers[helperIndex].index.push(i);
}
else {
helpers.push({ index: [i], msg: marker.msg });
}
codeThreadFlows.push({
location: {
id: i,
physicalLocation: {
artifactLocation: {
uri: position.file,
uri: position.file.substring(1),
uriBaseId: '%SRCROOT%',

@@ -134,3 +146,3 @@ },

});
// i += 1;
i += 1;
}

@@ -142,2 +154,3 @@ }

location: {
id: 0,
physicalLocation: {

@@ -158,2 +171,5 @@ artifactLocation: {

}
const { message, argumentArray } = getArgumentsAndMessage(helpers, result.message.text);
result.message.text = message;
result.message.arguments = argumentArray;
const newResult = {

@@ -175,2 +191,28 @@ ...result,

};
//custom string splice implementation
function stringSplice(str, index, count, add) {
// We cannot pass negative indexes directly to the 2nd slicing operation.
if (index < 0) {
index = str.length + index;
if (index < 0) {
index = 0;
}
}
return str.slice(0, index) + (add || '') + str.slice(index + count);
}
exports.stringSplice = stringSplice;
function getArgumentsAndMessage(helpers, message) {
let negativeOffset = 0;
let argumentArray = [];
let sortedArguements = helpers.sort((a, b) => a.msg[0] - b.msg[0]);
sortedArguements.forEach((arg, index) => {
let word = message.substring(arg.msg[0] + negativeOffset, arg.msg[1] + 1 + negativeOffset);
argumentArray.push(`[${word}]${arg.index.map((i) => `(${i})`)}`);
message = stringSplice(message, arg.msg[0] + negativeOffset, arg.msg[1] + 1 + negativeOffset - (arg.msg[0] + negativeOffset), `{${index}}`);
// (2 + index.toString().length) === number of inserted charecters, the 2 = {}
negativeOffset += arg.msg[0] - (arg.msg[1] + 1) + (2 + index.toString().length);
});
return { message, argumentArray };
}
exports.getArgumentsAndMessage = getArgumentsAndMessage;
//# sourceMappingURL=sarif_converter.js.map

2

package.json
{
"name": "@deepcode/tsc",
"version": "2.1.0",
"version": "2.1.1",
"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

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