picatic/node-permission-architect

View on GitHub

Showing 61 of 61 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  describe("buildProfile", function() {
    var instance;

    beforeEach(function() {
      instance = sessionRegistry.buildProfile("Name", "id", {my: "config"});
Severity: Major
Found in specs/SessionRegistrySpec.js and 1 other location - About 7 hrs to fix
specs/SessionRegistrySpec.js on lines 145..164

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 181.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  describe("buildResource", function() {
    var instance;

    beforeEach(function() {
      instance = sessionRegistry.buildResource("Name", "id", {my: "config"});
Severity: Major
Found in specs/SessionRegistrySpec.js and 1 other location - About 7 hrs to fix
specs/SessionRegistrySpec.js on lines 166..185

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 181.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      describe("context", function() {
        var resource, myContext;
    
        beforeEach(function() {
          myContext = {
    Severity: Major
    Found in specs/models/ResourceSpec.js and 1 other location - About 6 hrs to fix
    specs/models/ProfileSpec.js on lines 24..45

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 163.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      describe("context", function() {
        var profile, myContext;
    
        beforeEach(function() {
          myContext = {
    Severity: Major
    Found in specs/models/ProfileSpec.js and 1 other location - About 6 hrs to fix
    specs/models/ResourceSpec.js on lines 25..46

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 163.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      describe("constructor", function() {
        var resource;
    
        it('throws exception if name is not string', function() {
          var test = function() {
    Severity: Major
    Found in specs/models/ResourceSpec.js and 1 other location - About 4 hrs to fix
    specs/models/ProfileSpec.js on lines 6..22

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 128.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      describe("constructor", function() {
        var profile;
    
        it('throws exception if name is not string', function() {
          var test = function() {
    Severity: Major
    Found in specs/models/ProfileSpec.js and 1 other location - About 4 hrs to fix
    specs/models/ResourceSpec.js on lines 7..23

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 128.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        describe('forProfile', function() {
          var anotherProvider;
      
          beforeEach(function() {
            roleProvider = new RoleProvider('User', 'Event');
      Severity: Major
      Found in specs/RoleProviderRegistrySpec.js and 1 other location - About 4 hrs to fix
      specs/RoleProviderRegistrySpec.js on lines 62..75

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 123.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        describe('forResource', function() {
          var anotherProvider;
      
          beforeEach(function() {
            roleProvider = new RoleProvider('User', 'Event');
      Severity: Major
      Found in specs/RoleProviderRegistrySpec.js and 1 other location - About 4 hrs to fix
      specs/RoleProviderRegistrySpec.js on lines 47..60

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 123.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          describe("setSessionRegistry", function() {
            beforeEach(function() {
              permissionProvider = new PermissionProvider('create', {}, {});
            });
        
        
        Severity: Major
        Found in specs/PermissionProviderSpec.js and 1 other location - About 3 hrs to fix
        specs/PermissionProviderSpec.js on lines 53..63

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 96.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          describe("setImplementation", function() {
            beforeEach(function() {
              permissionProvider = new PermissionProvider('create', {}, {});
            });
        
        
        Severity: Major
        Found in specs/PermissionProviderSpec.js and 1 other location - About 3 hrs to fix
        specs/PermissionProviderSpec.js on lines 77..87

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 96.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            describe('resourcesForProfile', function() {
              var roleProviderRegistry;
              it('calls forProfile on RoleProviderRegistry', function() {
                roleProviderRegistry = sessionRegistry.getRoleProviderRegistry();
                spyOn(roleProviderRegistry, 'forProfile').andCallThrough();
          Severity: Major
          Found in specs/SessionRegistrySpec.js and 1 other location - About 2 hrs to fix
          specs/SessionRegistrySpec.js on lines 238..246

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 89.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            describe('profilesForResource', function() {
              var roleProviderRegistry;
              it('calls forResource on RoleProviderRegistry', function() {
                roleProviderRegistry = sessionRegistry.getRoleProviderRegistry();
                spyOn(roleProviderRegistry, 'forResource').andCallThrough();
          Severity: Major
          Found in specs/SessionRegistrySpec.js and 1 other location - About 2 hrs to fix
          specs/SessionRegistrySpec.js on lines 228..236

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 89.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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
            Severity
            Category
            Status
            Source
            Language