New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ggflutter/sumo

Package Overview
Dependencies
Maintainers
0
Versions
740
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ggflutter/sumo - npm Package Compare versions

Comparing version 2.5.74994 to 2.5.74995

2

package.json
{
"author": "Luigi Allocca",
"name": "@ggflutter/sumo",
"version": "2.5.74994",
"version": "2.5.74995",
"description": "A mutation testing tool for Ethereum smart contracts",

@@ -6,0 +6,0 @@ "repository": {

@@ -16,82 +16,50 @@ const Mutation = require('../../../mutation');

const params = node.parameters || [];
if (params.length > 0) {
const bodyNode = node.body;
if (params.length > 0 && bodyNode && bodyNode.statements) {
console.log("Found function parameters:", params.length);
params.forEach((param) => {
// Genera gli statement di assegnamento a valori nulli
const nullAssignments = params.map((param) => {
if (param.type === 'VariableDeclaration') {
const paramName = param.name;
const paramType = param.typeName.name;
const start = param.range[0];
const end = param.range[1];
const startLine = param.loc.start.line;
const endLine = param.loc.end.line;
const original = source.slice(start, end);
let nullValue;
let replacement;
switch (paramType) {
case "uint256":
case "int256":
case "uint":
case "int":
replacement = "0";
switch (param.typeName.name) {
case 'uint256':
case 'int256':
case 'uint':
case 'int':
nullValue = '0';
break;
case "address":
replacement = "address(0)";
case 'address':
nullValue = 'address(0)';
break;
case "bool":
replacement = "false";
case 'bool':
nullValue = 'false';
break;
case "string":
replacement = "''";
case 'string':
nullValue = '""';
break;
case "bytes":
replacement = "bytes(0)";
// Aggiungi altri tipi se necessario
default:
nullValue = '0';
break;
default:
replacement = "''";
}
// Inizializzazione del parametro all'inizio del corpo della funzione
const mutation = `
function ${node.name}(${params.map(p => `${p.typeName.name} ${p.name}`).join(', ')}) public {
${params.map(p => {
const type = p.typeName.name;
let init;
switch (type) {
case "uint256":
case "int256":
case "uint":
case "int":
init = "0";
break;
case "address":
init = "address(0)";
break;
case "bool":
init = "false";
break;
case "string":
init = "''";
break;
case "bytes":
init = "bytes(0)";
break;
default:
init = "''";
}
return `${p.name} = ${init};`;
}).join('\n')}
// Original function body
${source.slice(node.body.range[0], node.body.range[1])}
}
`;
return `${paramName} = ${nullValue};`;
}
}).join(' ');
mutations.push(new Mutation(file, start, end, startLine, endLine, original, mutation, this.ID));
console.log(`Mutation added for parameter: ${original} -> ${replacement}`);
}
});
const start = bodyNode.range[0];
const end = bodyNode.range[1];
const startLine = bodyNode.loc.start.line;
const endLine = bodyNode.loc.end.line;
const original = source.slice(start, end);
const mutation = `{ ${nullAssignments} ${original.slice(1)}`; // Inserisce gli assegnamenti nulli all'inizio del corpo
mutations.push(new Mutation(file, start, end, startLine, endLine, original, mutation, this.ID));
console.log(`Mutation added for function: ${original} -> ${mutation}`);
} else {
console.log("No parameters found or parameters are not of the expected type.");
console.log("No parameters found or body node is missing.");
}

@@ -98,0 +66,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