ivanruby/mpesa-mz-nodejs-lib

View on GitHub
src/transaction.js

Summary

Maintainability
A
0 mins
Test Coverage
B
83%

Function exports has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
Invalid

module.exports = function (options) {
  /** Public key - Required by the M-Pesa API
   * @member _public_key
   * @type {string}
   */
Severity: Minor
Found in src/transaction.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function exports has 246 lines of code (exceeds 25 allowed). Consider refactoring.
Invalid

module.exports = function (options) {
  /** Public key - Required by the M-Pesa API
   * @member _public_key
   * @type {string}
   */
Severity: Major
Found in src/transaction.js - About 1 day to fix

    Function _isValidated has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Wontfix

      this._isValidated = function (type, data) {
        this.validation_errors = []
    
        switch (type) {
          case 'config':
    Severity: Major
    Found in src/transaction.js - About 2 hrs to fix

      There are no issues that match your filters.

      Category
      Status