ripple/ripple-rest

View on GitHub
api/lib/db-interface.js

Summary

Maintainability
C
1 day
Test Coverage

Function saveTransaction has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

DI.saveTransaction = function(transaction, callback) {
  assert.strictEqual(typeof transaction, 'object');
  assert(transaction.state, 'Transaction missing property: state');
  assert(transaction.tx_json, 'Transaction missing property: tx_json');
  assert(transaction.tx_json.TransactionType,
Severity: Major
Found in api/lib/db-interface.js - About 2 hrs to fix

    Function getTransaction has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    DI.getTransaction = function(options, callback) {
      assert.strictEqual(typeof options, 'object');
    
      var txQuery = {};
    
    
    Severity: Minor
    Found in api/lib/db-interface.js - About 1 hr to fix

      Function init has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      DI.init = function(callback) {
        var self = this;
      
        if (this.initialized) {
          self.logger.info('[DB] Warning: Re-initializing');
      Severity: Minor
      Found in api/lib/db-interface.js - About 1 hr to fix

        Function getFailedTransactions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        DI.getFailedTransactions = function(options, callback) {
          assert.strictEqual(typeof options, 'object');
          assert.strictEqual(typeof options.account, 'string');
          assert(ripple.UInt160.is_valid(options.account),
                 'Specified account is invalid');
        Severity: Minor
        Found in api/lib/db-interface.js - About 1 hr to fix

          Function getFailedTransactions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          DI.getFailedTransactions = function(options, callback) {
            assert.strictEqual(typeof options, 'object');
            assert.strictEqual(typeof options.account, 'string');
            assert(ripple.UInt160.is_valid(options.account),
                   'Specified account is invalid');
          Severity: Minor
          Found in api/lib/db-interface.js - About 45 mins 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 getTransaction has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          DI.getTransaction = function(options, callback) {
            assert.strictEqual(typeof options, 'object');
          
            var txQuery = {};
          
          
          Severity: Minor
          Found in api/lib/db-interface.js - About 45 mins 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

          There are no issues that match your filters.

          Category
          Status