Showing 16 of 18 total issues
Function exports
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(async, _, Controller, PermissionService) {
var AccountController = null;
var PermissionController = Controller.extend(
{
Function requiresPermission
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
requiresPermission: function(requiredPermissions) {
if (requiredPermissions instanceof Array) {
requiredPermissions = {
all: requiredPermissions
}
Function exports
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(Promise, Service, RoleModel, PermissionService, underscore, async) {
var debug = require('debug')('cleverstack:services:RoleService');
return Service.extend({
model: RoleModel,
Function exports
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(Model, config, utils, Exceptions, PermissionModel, UserModel) {
return Model.extend('Role',
{
type : config['clever-roles'].driver || 'ORM',
timeStampable : true,
Function exports
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(Promise, Service, PermissionModel, async) {
return Service.extend({
model: PermissionModel,
- 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 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(Promise, Service, PermissionModel, async) {
return Service.extend({
model: PermissionModel,
Function AccountModel afterCreate
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
'AccountModel afterCreate': function(account, values, queryOptions, callback) {
Promise.all([
this.findDefaultRoles(queryOptions),
PermissionService.createAccountDefaultPermissions(account, values, queryOptions)
])
Function exports
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(Controller, RoleService, PermissionController, AccountController) {
return Controller.extend(
{
service: RoleService,
Function exports
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(Model, config, async, utils, Exceptions, UserModel, AccountModel) {
return Model.extend('Permission',
{
type : config['clever-roles'].driver || 'ORM',
timeStampable : true,
Function exports
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(Promise, Service, RoleModel, PermissionService, underscore, async) {
var debug = require('debug')('cleverstack:services:RoleService');
return Service.extend({
model: RoleModel,
- 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 userRoleHasPermission
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function userRoleHasPermission(permissions, callback) {
var hasPermission = true;
if (!!permissions.length && !req.isAuthenticated()) {
return callback('User is not authenticated!');
Function createAccountDefaultPermissions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
createAccountDefaultPermissions: function(account, values, queryOptions) {
return new Promise(function(resolve, reject) {
this
.findDefaultPermissions(queryOptions)
.then(this.proxy(function(defaultPermissions) {
Function exports
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function(Model, config, async, utils, Exceptions, UserModel, AccountModel) {
Function exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function(Promise, Service, RoleModel, PermissionService, underscore, async) {
Function exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function(Model, config, utils, Exceptions, PermissionModel, UserModel) {
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(Controller, RoleService, PermissionController, AccountController) {
return Controller.extend(
{
service: RoleService,
- 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"