diff --git a/package-lock.json b/package-lock.json
index 764888a..c75b7bb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,13 +1,13 @@
{
"name": "solidity-code-metrics",
- "version": "0.0.13",
+ "version": "0.0.14",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@solidity-parser/parser": {
- "version": "0.8.2",
- "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.8.2.tgz",
- "integrity": "sha512-8LySx3qrNXPgB5JiULfG10O3V7QTxI/TLzSw5hFQhXWSkVxZBAv4rZQ0sYgLEbc8g3L2lmnujj1hKul38Eu5NQ=="
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.11.0.tgz",
+ "integrity": "sha512-IaC4IaW8uoOB8lmEkw6c19y1vJBK/+7SzAbGQ+LmBYRPXSLNB+UgpORvmcAJEXhB04kWKyz/Os1U8onqm6U/+w=="
},
"ansi-regex": {
"version": "3.0.0",
@@ -177,6 +177,39 @@
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
},
+ "chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
+ }
+ }
+ },
"class-utils": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
@@ -199,11 +232,42 @@
}
},
"cli-table": {
- "version": "0.3.1",
- "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz",
- "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=",
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.4.tgz",
+ "integrity": "sha512-1vinpnX/ZERcmE443i3SZTmU5DF0rPO9DrL4I2iVAllhxzCM9SzPlHnz19fsZB78htkKZvYBvj6SZ6vXnaxmTA==",
"requires": {
- "colors": "1.0.3"
+ "chalk": "^2.4.1",
+ "string-width": "^4.2.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
+ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
+ },
+ "is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
+ },
+ "string-width": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
+ "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
+ "requires": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
+ "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+ "requires": {
+ "ansi-regex": "^5.0.0"
+ }
+ }
}
},
"cliui": {
@@ -243,11 +307,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
- "colors": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
- "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs="
- },
"commander": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
@@ -361,6 +420,11 @@
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw=="
},
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
+ },
"execa": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
@@ -581,6 +645,11 @@
"temp": "~0.4.0"
}
},
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
+ },
"has-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
@@ -771,9 +840,9 @@
}
},
"lodash": {
- "version": "4.17.19",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
- "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
+ "version": "4.17.20",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
+ "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
},
"map-age-cleaner": {
"version": "0.1.3",
@@ -1284,6 +1353,11 @@
"yargs": "^16.1.1"
},
"dependencies": {
+ "@solidity-parser/parser": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.8.2.tgz",
+ "integrity": "sha512-8LySx3qrNXPgB5JiULfG10O3V7QTxI/TLzSw5hFQhXWSkVxZBAv4rZQ0sYgLEbc8g3L2lmnujj1hKul38Eu5NQ=="
+ },
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
@@ -1343,9 +1417,9 @@
"integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg=="
},
"yargs": {
- "version": "16.1.1",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.1.1.tgz",
- "integrity": "sha512-hAD1RcFP/wfgfxgMVswPE+z3tlPFtxG8/yWUrG2i17sTWGCGqWnxKcLTF4cUKDUK8fzokwsmO9H0TDkRbMHy8w==",
+ "version": "16.2.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
"requires": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
@@ -1442,6 +1516,14 @@
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
},
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
"surya": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/surya/-/surya-0.4.1.tgz",
@@ -1456,6 +1538,11 @@
"yargs": "^11.1.1"
},
"dependencies": {
+ "@solidity-parser/parser": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.8.2.tgz",
+ "integrity": "sha512-8LySx3qrNXPgB5JiULfG10O3V7QTxI/TLzSw5hFQhXWSkVxZBAv4rZQ0sYgLEbc8g3L2lmnujj1hKul38Eu5NQ=="
+ },
"colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
diff --git a/package.json b/package.json
index d9fe5ae..91ebb30 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "solidity-code-metrics",
- "version": "0.0.13",
+ "version": "0.0.14",
"description": "Solidity Code Metrics",
"main": "src/index.js",
"scripts": {
@@ -25,7 +25,7 @@
},
"homepage": "https://github.com/ConsenSys/solidity-metrics#readme",
"dependencies": {
- "@solidity-parser/parser": "^0.8.2",
+ "@solidity-parser/parser": "^0.11.0",
"sloc": "^0.2.1",
"solidity-doppelganger": "0.0.4",
"surya": "^0.4.1"
diff --git a/src/metrics.js b/src/metrics.js
index 3b0247a..fdbb49b 100644
--- a/src/metrics.js
+++ b/src/metrics.js
@@ -334,10 +334,26 @@ This section lists files that are in scope for the metrics report.
Source Units Analyzed: **\`${this.seenFiles.length}\`**
Source Units in Scope: **\`${this.metrics.length}\`** (**${Math.round(this.metrics.length/this.seenFiles.length * 100)}%**)
-| Type | File | Logic Contracts | Interfaces | Lines | nSLOC | Comment Lines | Complex. Score | Capabilities |
+| Type | File | Logic Contracts | Interfaces | Lines | nLines | nSLOC | Comment Lines | Complex. Score | Capabilities |
|========|=================|============|=======|=======|===============|==============|
-${this.metrics.map(m => `| ${m.metrics.num.contracts ? "๐" : ""}${m.metrics.num.libraries ? "๐" : ""}${m.metrics.num.interfaces ? "๐" : ""}${m.metrics.num.abstract ? "๐จ" : ""} | ${m.filename.replace(this.basePath, "")} | ${(m.metrics.num.contracts + m.metrics.num.libraries + m.metrics.num.abstract) || "****"} | ${m.metrics.num.interfaces || "****"} | ${m.metrics.sloc.total || "****"} | ${m.metrics.nsloc.total || "****"} | ${m.metrics.sloc.comment || "****"} | ${m.metrics.complexity.perceivedNaiveScore || "****"} | **${m.metrics.capabilities.assembly ? "๐ฅ":""}${m.metrics.capabilities.experimental.length ? "๐งช":""}${m.metrics.capabilities.canReceiveFunds ? "๐ฐ":""}${m.metrics.capabilities.destroyable ? "๐ฃ":""}${m.metrics.capabilities.explicitValueTransfer ? "๐ค":""}${m.metrics.capabilities.lowLevelCall ? "โก":""}${m.metrics.capabilities.delegateCall ? "๐ฅ":""}${m.metrics.capabilities.hashFuncs ? "๐งฎ":""}${m.metrics.capabilities.ecrecover ? "๐":""}${m.metrics.capabilities.deploysContract ? "๐":""}${(doppelGanger !== undefined) && pathToDoppelganger && pathToDoppelganger[m.filename.replace(this.basePath, "")] ? "๐":""}** |`).join("\n")}
-| ${totals.totals.num.contracts ? "๐" : ""}${totals.totals.num.libraries ? "๐" : ""}${totals.totals.num.interfaces ? "๐" : ""}${totals.totals.num.abstract ? "๐จ" : ""} | **Totals** | **${(totals.totals.num.contracts + totals.totals.num.libraries + totals.totals.num.abstract) || ""}** | **${totals.totals.num.interfaces || ""}** | **${totals.totals.sloc.total}** | **${totals.totals.nsloc.total}** | **${totals.totals.sloc.comment}** | **${totals.totals.complexity.perceivedNaiveScore}** | **${totals.totals.capabilities.assembly ? "๐ฅ":""}${totals.totals.capabilities.experimental.length ? "๐งช":""}${totals.totals.capabilities.canReceiveFunds ? "๐ฐ":""}${totals.totals.capabilities.destroyable ? "๐ฃ":""}${totals.totals.capabilities.explicitValueTransfer ? "๐ค":""}${totals.totals.capabilities.lowLevelCall ? "โก":""}${totals.totals.capabilities.delegateCall ? "๐ฅ":""}${totals.totals.capabilities.hashFuncs ? "๐งฎ":""}${totals.totals.capabilities.ecrecover ? "๐":""}${totals.totals.capabilities.deploysContract ? "๐":""}${(doppelGanger !== undefined) && pathToDoppelganger && Object.keys(pathToDoppelganger).length ? "๐":""}** |
+${this.metrics.map(m => `| ${m.metrics.num.contracts ? "๐" : ""}${m.metrics.num.libraries ? "๐" : ""}${m.metrics.num.interfaces ? "๐" : ""}${m.metrics.num.abstract ? "๐จ" : ""} | ${m.filename.replace(this.basePath, "")} | ${(m.metrics.num.contracts + m.metrics.num.libraries + m.metrics.num.abstract) || "****"} | ${m.metrics.num.interfaces || "****"} | ${m.metrics.sloc.total || "****"} | ${m.metrics.nsloc.total || "****"} | ${m.metrics.nsloc.source || "****"} | ${m.metrics.sloc.comment || "****"} | ${m.metrics.complexity.perceivedNaiveScore || "****"} | **${m.metrics.capabilities.assembly ? "๐ฅ":""}${m.metrics.capabilities.experimental.length ? "๐งช":""}${m.metrics.capabilities.canReceiveFunds ? "๐ฐ":""}${m.metrics.capabilities.destroyable ? "๐ฃ":""}${m.metrics.capabilities.explicitValueTransfer ? "๐ค":""}${m.metrics.capabilities.lowLevelCall ? "โก":""}${m.metrics.capabilities.delegateCall ? "๐ฅ":""}${m.metrics.capabilities.hashFuncs ? "๐งฎ":""}${m.metrics.capabilities.ecrecover ? "๐":""}${m.metrics.capabilities.deploysContract ? "๐":""}${(doppelGanger !== undefined) && pathToDoppelganger && pathToDoppelganger[m.filename.replace(this.basePath, "")] ? "๐":""}** |`).join("\n")}
+| ${totals.totals.num.contracts ? "๐" : ""}${totals.totals.num.libraries ? "๐" : ""}${totals.totals.num.interfaces ? "๐" : ""}${totals.totals.num.abstract ? "๐จ" : ""} | **Totals** | **${(totals.totals.num.contracts + totals.totals.num.libraries + totals.totals.num.abstract) || ""}** | **${totals.totals.num.interfaces || ""}** | **${totals.totals.sloc.total}** | **${totals.totals.nsloc.total}** | **${totals.totals.nsloc.source}** | **${totals.totals.sloc.comment}** | **${totals.totals.complexity.perceivedNaiveScore}** | **${totals.totals.capabilities.assembly ? "๐ฅ":""}${totals.totals.capabilities.experimental.length ? "๐งช":""}${totals.totals.capabilities.canReceiveFunds ? "๐ฐ":""}${totals.totals.capabilities.destroyable ? "๐ฃ":""}${totals.totals.capabilities.explicitValueTransfer ? "๐ค":""}${totals.totals.capabilities.lowLevelCall ? "โก":""}${totals.totals.capabilities.delegateCall ? "๐ฅ":""}${totals.totals.capabilities.hashFuncs ? "๐งฎ":""}${totals.totals.capabilities.ecrecover ? "๐":""}${totals.totals.capabilities.deploysContract ? "๐":""}${(doppelGanger !== undefined) && pathToDoppelganger && Object.keys(pathToDoppelganger).length ? "๐":""}** |
+
+
+Legend: [โ]
+
+
+
+- Lines: total lines of the source unit
+- nLines: normalized lines of the source unit (e.g. normalizes functions spanning multiple lines)
+- nSLOC: normalized source lines of code (only source-code lines; no comments, no blank lines)
+- Comment Lines: lines containing single or block comments
+- Complexity Score: a custom complexity score derived from code statements that are known to introduce code complexity (branches, loops, calls, external interfaces, ...)
+
+
+
+
+
#### Out of Scope