Socket
Socket
Sign inDemoInstall

solidity-code-metrics

Package Overview
Dependencies
47
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    solidity-code-metrics

Solidity Code Metrics


Version published
Weekly downloads
465
increased by46.69%
Maintainers
1
Install size
26.4 MB
Created
Weekly downloads
 

Changelog

Source

v0.0.26

  • new: show deployable contracts - #19
  • new: users can provide a scope file - #17

Readme

Source

get in touch with Consensys Diligence
[ 🌐 📩 🔥 ]

Solidity Code Metrics

🌐 npm install solidity-code-metrics

The number-crunching enginge behind 📊tintinweb.solidity-metrics.

vscode-solidity-metrics3

Example

CLI

To use the CLI from the compiled sources you can do:

node ./src/cli.js <path to solidity file(s)>

It is however more useful to install solidity-metrics globally and call it from any directory:

npm install -g solidity-code-metrics
solidity-code-metrics myfile1.sol myfile2.sol

By default, the cli outputs to the console, you can however store the output in a file rather easily (both markdown and html are supported):

solidity-code-metrics myfile.sol > metrics.md
solidity-code-metrics myfile.sol --html > metrics.html

Library


const {SolidityMetricsContainer} = require('solidity-metrics');

let options = {
    basePath:"",
    inputFileGlobExclusions:undefined,
    inputFileGlob: undefined,
    inputFileGlobLimit: undefined,
    debug:false,
    repoInfo: {
        branch: undefined,
        commit: undefined,
        remote: undefined
    }    
}

let metrics = new SolidityMetricsContainer("metricsContainerName", options);


// analyze files
metrics.analyze(path_to_solidity_file);
// ...
metrics.analyze(path_to_solidity_file_N);

// output
console.log(metrics.totals());
metrics.generateReportMarkdown().then(text => console.log(text));
// or let text = await metrics.generateReportMarkdown();

Keywords

FAQs

Last updated on 27 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc