0.0.26 • Published 1 month ago

solidity-code-metrics v0.0.26

Weekly downloads
22
License
MIT
Repository
github
Last release
1 month ago

[ 🌐 📩 🔥 ]

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();
0.0.26

1 month ago

0.0.25

7 months ago

0.0.23

1 year ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.19

2 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.16-rc1

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago