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}
*/
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');
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');
- Read upRead up
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}
- Read upRead up
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');
Function SessionRegistry
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function SessionRegistry(name) {
/**
* Name of this instance
* @type {String}
*/
- Read upRead up
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'),
Function PermissionRegistry
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function PermissionRegistry(sessionRegistry) {
/**
* Reference to the Security Registry
* @private
* @type {SessionRegistry}
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) {
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');
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');
- Read upRead up
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');
}
Function RoleProviderRegistry
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function RoleProviderRegistry(sessionRegistry) {
/**
* Reference to SessionRegistry
* @type {SessionRegistry}
*/
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;
}
Function RoleProviderRegistry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function RoleProviderRegistry(sessionRegistry) {
/**
* Reference to SessionRegistry
* @type {SessionRegistry}
*/
- Read upRead up
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"