CleverStack/clever-accounts

View on GitHub

Showing 9 of 14 total issues

Function exports has 171 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(Controller, AccountService, config, async, $PermissionController) {
  var autoRouting = [];

  if ($PermissionController !== null) {
    autoRouting.push(
Severity: Major
Found in controllers/AccountController.js - About 6 hrs to fix

    Function exports has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function(Controller, AccountService, config, async, $PermissionController) {
      var autoRouting = [];
    
      if ($PermissionController !== null) {
        autoRouting.push(
    Severity: Minor
    Found in controllers/AccountController.js - About 4 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 addAccountIdToRequest has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        addAccountIdToRequest: function(requiredRoutes) {
          if (typeof requiredRoutes !== 'object') {
            requiredRoutes = {
              all: [ requiredRoutes !== undefined ? requiredRoutes : true ]
            };
    Severity: Major
    Found in controllers/AccountController.js - About 2 hrs to fix

      Function exports has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(Promise, Service, AccountModel, config, UserService, _) {
        return Service.extend({
      
          model: AccountModel,
      
      
      Severity: Major
      Found in services/AccountService.js - About 2 hrs to fix

        Function create has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            create: function(values, queryOptions) {
              var createAccount = this._super;
        
              queryOptions  = queryOptions || {};
        
        
        Severity: Major
        Found in services/AccountService.js - About 2 hrs to fix

          Function exports has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(Model, config, utils, UserModel) {
            return Model.extend('Account',
            {
              type              : config['clever-accounts'].driver || 'ORM',
              timeStampable     : true,
          Severity: Minor
          Found in models/AccountModel.js - About 1 hr to fix

            Function exports has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            module.exports = function(Promise, Service, AccountModel, config, UserService, _) {
            Severity: Minor
            Found in services/AccountService.js - About 45 mins to fix

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

              module.exports = function(Controller, AccountService, config, async, $PermissionController) {
              Severity: Minor
              Found in controllers/AccountController.js - About 35 mins to fix

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

                module.exports = function(Promise, Service, AccountModel, config, UserService, _) {
                  return Service.extend({
                
                    model: AccountModel,
                
                
                Severity: Minor
                Found in services/AccountService.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

                Severity
                Category
                Status
                Source
                Language