MitocGroup/deep-framework

View on GitHub
src/deep-db/lib/Vogels/ExtendModel.js

Summary

Maintainability
D
2 days
Test Coverage

Function methods has 193 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  get methods() {
    let _this = this;

    return {
      
Severity: Major
Found in src/deep-db/lib/Vogels/ExtendModel.js - About 7 hrs to fix

    File ExtendModel.js has 363 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Created by Stefan Hariton on 6/26/15.
     */
    
    'use strict';
    Severity: Minor
    Found in src/deep-db/lib/Vogels/ExtendModel.js - About 4 hrs to fix

      Function methods has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        get methods() {
          let _this = this;
      
          return {
            
      Severity: Minor
      Found in src/deep-db/lib/Vogels/ExtendModel.js - About 3 hrs 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 _registerQueryWrappers has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _registerQueryWrappers() {
          this._model.setPartition = function(partition) {
            this[ExtendModel.PARTITION_KEY] = partition;
          };
      
      
      Severity: Minor
      Found in src/deep-db/lib/Vogels/ExtendModel.js - About 1 hr to fix

        Function _findUntilLimit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              _findUntilLimit(query, limit, _scannedCount = 0, _accumulator = [], _lastKey = null) {
                return new Promise((resolve, reject) => {
                  if (_lastKey) {
                    query.startKey(_lastKey);
                  }
        Severity: Minor
        Found in src/deep-db/lib/Vogels/ExtendModel.js - About 1 hr to fix

          Function _applyRumDecorator has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _applyRumDecorator(method, eventName) {
              return (...args) => {
                if (!this.model.logService) {
                  return method(...args);
                }
          Severity: Minor
          Found in src/deep-db/lib/Vogels/ExtendModel.js - About 1 hr to fix

            Function _registerQueryWrappers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              _registerQueryWrappers() {
                this._model.setPartition = function(partition) {
                  this[ExtendModel.PARTITION_KEY] = partition;
                };
            
            
            Severity: Minor
            Found in src/deep-db/lib/Vogels/ExtendModel.js - About 1 hr 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 _findUntilLimit has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  _findUntilLimit(query, limit, _scannedCount = 0, _accumulator = [], _lastKey = null) {
            Severity: Minor
            Found in src/deep-db/lib/Vogels/ExtendModel.js - About 35 mins to fix

              Function findAllByPaginated has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    findAllByPaginated: function(fieldName, value, startKey, limit, cb) {
              Severity: Minor
              Found in src/deep-db/lib/Vogels/ExtendModel.js - About 35 mins to fix

                Function inject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  inject(methods = null) {
                    let predefinedMethods = this.methods;
                    let predefinedMethodsNames = Object.keys(predefinedMethods);
                
                    methods = methods || predefinedMethodsNames;
                Severity: Minor
                Found in src/deep-db/lib/Vogels/ExtendModel.js - About 25 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