picatic/node-permission-architect

View on GitHub

Showing 15 of 61 total issues

Function SessionRegistry has 175 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function SessionRegistry(name) {
  /**
   * Name of this instance
   * @type {String}
   */
Severity: Major
Found in lib/SessionRegistry.js - About 7 hrs to fix

    File SessionRegistrySpec.js has 353 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    "use strict";
    
    var SessionRegistry = require('../lib/SessionRegistry');
    var Models = require('../lib/models');
    var PermissionProvider = require('../lib/PermissionProvider');
    Severity: Minor
    Found in specs/SessionRegistrySpec.js - About 4 hrs to fix

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

      function RoleProvider (profileName, resourceName, implementation, sessionRegistry) {
      
        // Pre-conditions
        if (_.isString(profileName) === false) {
          throw new Errors.PermissionArchitectRoleProviderError('Expected profileName to be string');
      Severity: Minor
      Found in lib/RoleProvider.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 PermissionRegistry has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      function PermissionRegistry(sessionRegistry) {
        /**
         * Reference to the Security Registry
         * @private
         * @type {SessionRegistry}
      Severity: Minor
      Found in lib/PermissionRegistry.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 RoleProvider has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function RoleProvider (profileName, resourceName, implementation, sessionRegistry) {
      
        // Pre-conditions
        if (_.isString(profileName) === false) {
          throw new Errors.PermissionArchitectRoleProviderError('Expected profileName to be string');
      Severity: Major
      Found in lib/RoleProvider.js - About 3 hrs to fix

        Function SessionRegistry has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        function SessionRegistry(name) {
          /**
           * Name of this instance
           * @type {String}
           */
        Severity: Minor
        Found in lib/SessionRegistry.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 exports has 75 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(grunt) {
        
          // Project configuration.
          grunt.initConfig({
            pkg: grunt.file.readJSON('package.json'),
        Severity: Major
        Found in Gruntfile.js - About 3 hrs to fix

          Function PermissionRegistry has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function PermissionRegistry(sessionRegistry) {
            /**
             * Reference to the Security Registry
             * @private
             * @type {SessionRegistry}
          Severity: Major
          Found in lib/PermissionRegistry.js - About 2 hrs to fix

            Function bestRoleFor has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              this.bestRoleFor = function(profile, resource, cb) {
                var self = this;
                var key = "bestRoleFor[" + profile.cacheName() + resource.cacheName() + "]";
                if (self._cache !== null) {
                  self._cache.get(key, function(err, val) {
            Severity: Minor
            Found in lib/SessionRegistry.js - About 1 hr to fix

              Function PermissionProvider has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function PermissionProvider(name, implementation, sessionRegistry) {
              
                // Pre-conditions
                if (_.isString(name) === false) {
                  throw new Errors.PermissionArchitectPermissionProviderError('Expected name to be string');
              Severity: Minor
              Found in lib/PermissionProvider.js - About 1 hr to fix

                Function PermissionProvider has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function PermissionProvider(name, implementation, sessionRegistry) {
                
                  // Pre-conditions
                  if (_.isString(name) === false) {
                    throw new Errors.PermissionArchitectPermissionProviderError('Expected name to be string');
                Severity: Minor
                Found in lib/PermissionProvider.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 getPermission has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  this.getPermission = function(permissionName, resource, role, cb) {
                    // Pre-conditions
                    if (typeof(cb) !== 'function') {
                      throw new Errors.PermissionArchitectPermissionRegistryError('Expected cb to be type of function');
                    }
                Severity: Minor
                Found in lib/PermissionRegistry.js - About 1 hr to fix

                  Function RoleProviderRegistry has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function RoleProviderRegistry(sessionRegistry) {
                    /**
                     * Reference to SessionRegistry
                     * @type {SessionRegistry}
                     */
                  Severity: Minor
                  Found in lib/RoleProviderRegistry.js - About 1 hr to fix

                    Function allRoles has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      this.allRoles = function(profile, resource, cb) {
                        var self = this;
                        if (preconditions(profile, resource, cb) === false) {
                          return;
                        }
                    Severity: Minor
                    Found in lib/RoleProvider.js - About 1 hr to fix

                      Function RoleProviderRegistry has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function RoleProviderRegistry(sessionRegistry) {
                        /**
                         * Reference to SessionRegistry
                         * @type {SessionRegistry}
                         */
                      Severity: Minor
                      Found in lib/RoleProviderRegistry.js - About 55 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