We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi there,
First things first, nice work! I have found a small problem with the calculation of the Maintainability Index formula used in: https://github.com/typhonjs-node-escomplex/escomplex-plugin-metrics-module The following line: (0.23 * averageCyclomatic === 0 ? 0 : Math.log(averageCyclomatic)) The ternary expression used does not evaluate as intended. It evaluates to 0.23 * averageCyclomatic rather than 0.23 * Math.log(averageCyclomatic) whenever the averageCyclomatic is not a zero, as stated in the documentation: https://github.com/typhonjs-node-escomplex/escomplex-plugin-metrics-module/blob/7a4ddb6a0def5c90b8aa2f06c3e0867ba10eacd6/src/ModuleMetricPostAverage.js#L45-L49
(0.23 * averageCyclomatic === 0 ? 0 : Math.log(averageCyclomatic))
0.23 * averageCyclomatic
0.23 * Math.log(averageCyclomatic)
averageCyclomatic
A quick fix is to update the expression, by wrapping the ternary expression with brackets, leading to proper evaluation of the expression.
I have fixed it in a PR here if suitable: typhonjs-node-escomplex/escomplex-plugin-metrics-module#1
Thanks!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi there,
First things first, nice work!
I have found a small problem with the calculation of the Maintainability Index formula used in: https://github.com/typhonjs-node-escomplex/escomplex-plugin-metrics-module
The following line:
(0.23 * averageCyclomatic === 0 ? 0 : Math.log(averageCyclomatic))
The ternary expression used does not evaluate as intended. It evaluates to
0.23 * averageCyclomatic
rather than0.23 * Math.log(averageCyclomatic)
whenever theaverageCyclomatic
is not a zero, as stated in the documentation:https://github.com/typhonjs-node-escomplex/escomplex-plugin-metrics-module/blob/7a4ddb6a0def5c90b8aa2f06c3e0867ba10eacd6/src/ModuleMetricPostAverage.js#L45-L49
A quick fix is to update the expression, by wrapping the ternary expression with brackets, leading to proper evaluation of the expression.
I have fixed it in a PR here if suitable: typhonjs-node-escomplex/escomplex-plugin-metrics-module#1
Thanks!
The text was updated successfully, but these errors were encountered: